Home » Source Book » What are Hooks in WordPress? Types of Hooks in WordPress

What are Hooks in WordPress? Types of Hooks in WordPress

Last updated on June 4, 2020 by

Table of Contents
1. Types of Hooks in WordPress
2. Actions Hooks
3. Filters Hooks

Hooks are the functions used to modify the existing code in WordPress. Hooks can modify the code of plugins, themes, and even default WordPress functionality.

Types of Hooks in WordPress

There are two types of hooks available in WordPress Actions & Filters. Both hooks used by the plugins and theme developers to interact & modify the WordPress core functionalities.

1. Actions Hooks

Actions hooks look like an event. As the event runs at a certain point the same way Actions hooks run at a certain point in the execution of WordPress.

For better understanding, let’s see some examples of Actions Hooks in the very simplest words.

  1. Send emails when your blog post published
  2. Add database entry when someone login to your site
  3. When users delete their account then remove all data with it

Are you getting it? It’s so simple to understand.

2. Filters Hooks

In very simplest words Filters hooks are used to modify the data. Filters hooks take the data and modify it and return it with the newer version.

For better understanding, let’s see some examples of Filters Hooks in the very simplest words.

  1. Change the default length of the excerpt
  2. Add CSS Class or ID in body tag when certain condition met
  3. You can change the title, style, and other pre-defined data too

Leave a Comment