WP_CLI::confirm() Edit

Ask for confirmation before running a destructive operation.


Usage Usage

WP_CLI::confirm( $question, $assoc_args = array() )
$question (string) Question to display before the prompt.
$assoc_args (array) Skips prompt if ‘yes’ is provided.

Top ↑

Notes Notes

If ‘y’ is provided to the question, the script execution continues. If
‘n’ or any other response is provided to the question, script exits.

# `wp db drop` asks for confirmation before dropping the database.

WP_CLI::confirm( "Are you sure you want to drop the database?", $assoc_args );

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-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/ codebase on every release. To suggest improvements, please submit a pull request.


Top ↑

Last updated: