Skip to content
wp-skills
Register
tools/wordpress-hook-generator

WordPress Hook Generator

The WordPress Hook Generator allows you to generate the code for WordPress hooks in a few clicks.

Give it a prefix of your own. A callback named after the core function it wraps is a fatal redeclaration.

An action does something; a filter changes a value and returns it.

Every action WordPress 7.1 fires under a fixed name. Picking one fills in the parameters its callback is handed.

A filter must return a value. The generated callback returns its first parameter, which is the one being filtered.

The callback's parameters, filled in from the hook you picked. Read from core's docblock, so these are the names the handbook uses.

Lower runs earlier. 10 is the default, and what most callbacks want.

WordPress hands a callback one argument unless this says otherwise — declaring parameters is not enough on its own.

snippet.php
function wp_skills_custom_hook() {
	// Your code...
}
add_action( 'activate_header', 'wp_skills_custom_hook', 10, 0 );