handbook/references/internal-api/wp-cli-confirm.md
Pascal Birchler 264cb131bf
Fix handbook information architecture
- Organize files in folders according to the desired structure
- Use directory iterator to loop through all files and folders (makes generation more robust)
2025-06-25 15:38:39 +02:00

2.2 KiB

WP_CLI::confirm()

Ask for confirmation before running a destructive operation.


Usage

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

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 API documentation is generated from the WP-CLI codebase on every release. To suggest improvements, please submit a pull request.