→ How to use FacetWP Hooks

Hooks are a very powerful feature in WordPress. They allow developers to modify functionality without needing to touch the original codebase. To learn more about how WP Hooks work, check out the wonderful Treehouse overview.

Usage

There are a couple ways to use hooks. The preferred way is to add a custom plugin, but you could also use your theme’s functions.php file.

Custom Plugin

Download our custom plugin

The above plugin is a shell used to “hold” custom hooks. The main benefit is that it doesn’t depend on your theme, so you can switch themes without losing your custom hooks.

To use the above plugin, Activate it, then add any custom hooks into custom-hooks.php. You can use WP’s built-in plugin editor if needed.

functions.php

Hooks code can also be added directly into your theme’s functions.php file.

The downside of this approach is that if you ever decide to switch themes, your custom hooks will no longer be used. Also, if you’re not using a Child Theme and you upgrade the theme, all customizations will be lost.