mirror of
https://gh.wpcy.net/https://github.com/wp-cli/handbook.git
synced 2026-04-26 05:41:26 +08:00
- Organize files in folders according to the desired structure - Use directory iterator to loop through all files and folders (makes generation more robust)
1.4 KiB
1.4 KiB
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)
$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.
Related
- WP_CLI::add_hook() - Schedule a callback to be executed at a certain point.
- WP_CLI::do_hook() - Execute callbacks registered to a given hook.
- WP_CLI::add_command() - Register a command to WP-CLI.