Wraps errors in a nice header and footer and dies.
Description
Will not die if wpdb::$show_errors is false.
Parameters
$message
stringrequired- The error message.
$error_code
stringoptional- A computer-readable string to identify the error.
Default'500'
.Default:
'500'
Source
public function bail( $message, $error_code = '500' ) {
if ( $this->show_errors ) {
$error = '';
if ( $this->dbh instanceof mysqli ) {
$error = mysqli_error( $this->dbh );
} elseif ( mysqli_connect_errno() ) {
$error = mysqli_connect_error();
}
if ( $error ) {
$message = '<p><code>' . $error . "</code></p>\n" . $message;
}
wp_die( $message );
} else {
if ( class_exists( 'WP_Error', false ) ) {
$this->error = new WP_Error( $error_code, $message );
} else {
$this->error = $message;
}
return false;
}
}
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.