dead_db [ WordPress Function ]
| Uses: |
|
| Defined at: |
|
Load custom DB error or display WordPress DB error.
If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not found, then the WordPress DB error will be displayed instead.
The WordPress DB error sets the HTTP status header to 500 to try to prevent search engines from caching the message. Custom DB messages should do the same.
This function was backported to the the WordPress 2.3.2, but originally was added in WordPress 2.5.0.
Source
<?php
function dead_db() {
global $wpdb;
// Load custom DB error template, if present.
if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
require_once( WP_CONTENT_DIR . '/db-error.php' );
die();
}
// If installing or in the admin, provide the verbose message.
if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
wp_die($wpdb->error);
// Otherwise, be terse.
status_header( 500 );
nocache_headers();
header( 'Content-Type: text/html; charset=utf-8' );
wp_load_translations_early();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php _e( 'Database Error' ); ?></title>
</head>
<body>
<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
</body>
</html>
<?php
die();
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Docs for page functions.php
dead_db (line 2591). Load custom DB error or display WordPress DB error. If a file exists in the wp-content directory named db-error.php, then it will be loaded ...
phpdoc.wordpress.org - How To Get Precise Error Messages For Issues Related To ...
May 6, 2010 ... You just have to insert the PHP method mysql_error() inside function dead_db() as shown below: /** * Load custom DB error or display ...
7php.com - dead_db | A HitchHackers guide through WordPress
Feb 11, 2011 ... If a file exists in the wp-content directory named db-error.php, then it will be loaded instead of displaying the WordPress DB error. If it is not ...
hitchhackerguide.com - Famous Dead, Celebrity Deaths, Dead People | FamousDEAD.com
Search the Famous DeadDB. Search for: Complete Dead List: Actors, Politicians, Athletes Causes of Death: What's the most common death? Famous Dead ...
www.famousdead.com
Gebruikersdiscussies [ wordpress.org ]
- thetooon on "How to change message "Error establishing a database connection""
- thetooon on "How to change message "Error establishing a database connection""
- thetooon on "How to change message "Error establishing a database connection""
- vici on "How to change message "Error establishing a database connection""
- dor on "How to change message "Error establishing a database connection""
- whooami on "How to change message "Error establishing a database connection""
- dor on "How to change message "Error establishing a database connection""
- liquidrice on "How to change message "Error establishing a database connection""