WordPress Hooks Functions

Beginner
5 min read
Updated: Nov 2026
6 function guides
Function index

About This Index

This page is the WordPress Hooks Functions index. Each row links to a full guide with syntax, three examples, and FAQs.

Learn what hooks are and how actions and filters differ on WordPress Hooks. Use this page when you need one function, such as add_action(), add_filter(), or apply_filters().

Remember.

An action runs your code at a moment (add_action() and do_action()). A filter changes a value, and your function must return it (add_filter() and apply_filters()). Lower priority numbers run first, and the default is 10.

How to Call a Hooks Function

Most of the time you add hooks in functions.php. Here is one action and one filter side by side.

WordPress
<?php
// Action: do something when the hook fires.
add_action( 'wp_footer', 'my_footer_note' );

// Filter: change a value, then return it.
add_filter( 'excerpt_length', 'my_excerpt_length' );

function my_footer_note() {
  echo '<p>Thanks for visiting!</p>';
}
function my_excerpt_length( $length ) {
  return 20;
}

WordPress Hooks Functions Table

All function guides in this WordPress hooks series (6 tutorials). Start with add_action() and add_filter().

Actions

3 functions

Run code at a moment: attach it, fire it, or remove it.

FunctionDescriptionTutorial
add_action()Run your function when an action hook fires (do something).Read guide
do_action()Fire an action hook so every function added to it runs.Read guide
remove_action()Unhook a function that was added with add_action().Read guide

Filters

3 functions

Change a value: attach a filter, run the filters, or remove one.

FunctionDescriptionTutorial
add_filter()Change a value when a filter hook runs. The function must return it.Read guide
apply_filters()Pass a value through every filter on a hook and get the result back.Read guide
remove_filter()Unhook a function that was added with add_filter().Read guide

Frequently Asked Questions

They are the functions that work with hooks: add_action() and add_filter() attach your code, do_action() and apply_filters() trigger hooks, and remove_action() and remove_filter() detach code.
An action runs your code at a moment and needs no return value. A filter receives a value, changes it, and must return it.
Start with add_action(), then add_filter(). Learn do_action() and apply_filters() when you want to make your own hooks, and the remove functions when you need to turn something off.
Put add_action() and add_filter() in your theme's functions.php or in a plugin file, so they run before WordPress fires the hook.
Priority sets the order when many functions use one hook. Lower numbers run earlier. The default is 10.
WordPress uses the value your filter returns. If you forget return, the value becomes empty and content or settings can disappear.

Start with add_action()

Run your function when a WordPress action hook fires.

add_action() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful