handbook/internal-api/wp-cli-do-hook.md
Pascal Birchler aac59dc7fc
Regenerate
2025-12-17 21:53:06 +01:00

1.3 KiB

WP_CLI::do_hook()

Execute callbacks registered to a given hook.


Usage

WP_CLI::do_hook( $when, $args )
$when (string) Identifier for the hook.
...$args (mixed) Optional. Arguments that will be passed onto the
callback provided by `WP_CLI::add_hook()`.
@return (null|mixed) the first optional argument if optional<br /> arguments were passed, otherwise returns null.

Notes

See WP_CLI::add_hook() for details on WP-CLI's internal hook system. Commands can provide and call their own hooks.

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