WP_CLI::do_hook() Edit

Execute callbacks registered to a given hook.


WP_CLI::do_hook( $when, $args )
$when (string) Identifier for the hook.
…$args (mixed) Optional. Arguments that will be passed onto the
@return (null|mixed) the first optional argument if optional

Top ↑


See WP_CLI::add_hook() for details on WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/’s internal hook system.
Commands can provide and call their own hooksHooks In WordPress theme and development, hooks are functions that can be applied to an action or a Filter in WordPress. Actions are functions performed when a certain event occurs in WordPress. Filters allow you to modify certain functions. Arguments used to hook both filters and actions look the same..
callback provided by WP_CLI::add_hook().
arguments were passed, otherwise returns null.

Internal APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.

Top ↑

  • WP_CLI::add_hook() – Schedule a callback to be executed at a certain point.
  • WP_CLI::add_wp_hook() – Add a callback to a WordPress action or filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output..
  • WP_CLI::add_command() – Register a command to WP-CLI.

Last updated: