What is hooks in WordPress?

Posted by Prem Tiwari | Updated on

Hooks are a way for one piece of code to interact/modify another piece of code. They make up the foundation for how plugins and themes interact with WordPress Core, but they’re also used extensively by Core itself.

There are two types of hooks: Actions and Filters. To use either, you need to write a custom function known as a Callback, and then register it with WordPress hook for a specific Action or Filter.

Below is an example of a hook used with a filter in WordPress:

Examples WordPress of Hooks in Action

Following example demonstrate how to register a Custom Menu in the Admin.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers