Codex tools: Log in
Contents |
Kill WordPress execution and display HTML message with error message.
A call to this function complements the die() PHP function. The difference is that HTML will be displayed to the user. It is recommended to use this function only when the execution should not continue any further. It is not recommended to call this function very often and try to handle as many errors as possible siliently.
<?php wp_die( $message, $title, $args ) ?>
Test to see what is in the $post variable in a filter:
add_filter( 'body_class', 'add_body_class_cb' );
/**
* Add new body class.
*
* Testing what is in the $post variable.
*/
function add_body_class_cb( $classes ) {
global $post;
wp_die( '<pre>' . var_export( $post, true ) . '</pre>' );
}
You can add a WP_Error object. If you've done so, you can add $data['title'] to the error object and it will automatically be taken as (default/overwriteable) title for the die page.
[example missing here]
wp_die() is located in wp-includes/functions.php.