WP-CLI

A command line interface for WordPress

Docs » Internal API » Registration

WP_CLI::add_wp_hook()

Add a callback to a WordPress action or filter.


Usage

WP_CLI::add_wp_hook( $tag, $function_to_add, $priority = 10, $accepted_args = 1 )
$tag (string) Named WordPress action or filter.
$function_to_add (mixed) Callable to execute when the action or filter is evaluated.
$priority (integer) Priority to add the callback as.
$accepted_args (integer) Number of arguments to pass to callback.
@return (true)

Notes

add_action() without needing access to add_action(). If WordPress is already loaded though, you should use add_action() (and add_filter()) instead.

Internal API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.