Index: wp-login.php
===================================================================
--- wp-login.php	(revision 3984)
+++ wp-login.php	(working copy)
@@ -98,7 +98,7 @@
 	$user_email = $user_data->user_email;
 
 	if (!$user_email || $user_email != $_POST['email'])
-		die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.'), 'wp-login.php?action=lostpassword'));
+		wp_die(sprintf(__('Sorry, that user does not seem to exist in our database. Perhaps you have the wrong username or e-mail address? <a href="%s">Try again</a>.'), 'wp-login.php?action=lostpassword'));
 
 do_action('retreive_password', $user_login);  // Misspelled and deprecated.
 do_action('retrieve_password', $user_login);
@@ -118,11 +118,11 @@
 	if ($m == false) {
 		 echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";
          echo  __('Possible reason: your host may have disabled the mail() function...') . "</p>";
-		die();
+		wp_die();
 	} else {
 		echo '<p>' .  sprintf(__("The e-mail was sent successfully to %s's e-mail address."), $user_login) . '<br />';
 		echo  "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';
-		die();
+		wp_die();
 	}
 
 break;
@@ -132,10 +132,10 @@
 	// Generate something random for a password... md5'ing current time with a rand salt
 	$key = preg_replace('/a-z0-9/i', '', $_GET['key']);
 	if ( empty($key) )
-		die( __('Sorry, that key does not appear to be valid.') );
+		wp_die( __('Sorry, that key does not appear to be valid.') );
 	$user = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE user_activation_key = '$key'");
 	if ( !$user )
-		die( __('Sorry, that key does not appear to be valid.') );
+		wp_die( __('Sorry, that key does not appear to be valid.') );
 
 	do_action('password_reset');
 
@@ -152,14 +152,14 @@
 	if ($m == false) {
 		echo '<p>' . __('The e-mail could not be sent.') . "<br />\n";
 		echo  __('Possible reason: your host may have disabled the mail() function...') . '</p>';
-		die();
+		wp_die();
 	} else {
 		echo '<p>' .  sprintf(__('Your new password is in the mail.'), $user_login) . '<br />';
         echo  "<a href='wp-login.php' title='" . __('Check your e-mail first, of course') . "'>" . __('Click here to login!') . '</a></p>';
 		// send a copy of password change notification to the admin
 		$message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
 		wp_mail(get_settings('admin_email'), sprintf(__('[%s] Password Lost/Change'), get_settings('blogname')), $message);
-		die();
+		wp_die();
 	}
 break;
 
Index: wp-blog-header.php
===================================================================
--- wp-blog-header.php	(revision 3984)
+++ wp-blog-header.php	(working copy)
@@ -18,4 +18,4 @@
 
 endif;
 
-?>
\ No newline at end of file
+?>
Index: wp-includes/wp-db.php
===================================================================
--- wp-includes/wp-db.php	(revision 3984)
+++ wp-includes/wp-db.php	(working copy)
@@ -355,7 +355,7 @@
 HEAD;
 	echo $message;
 	echo "</body></html>";
-	die();
+	wp_die();
 	}
 }
 
Index: wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php
===================================================================
--- wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php	(revision 3984)
+++ wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php	(working copy)
@@ -71,7 +71,7 @@
 			fwrite($fh, "^$word\n");
 			fclose($fh);
 		} else
-			die("Error opening tmp file.");
+			wp_die("Error opening tmp file.");
 
 		$data = shell_exec($this->cmd);
 		@unlink($this->tmpfile);
Index: wp-includes/comment.php
===================================================================
--- wp-includes/comment.php	(revision 3984)
+++ wp-includes/comment.php	(working copy)
@@ -181,7 +181,7 @@
 		$dupe .= "OR comment_author_email = '$comment_author_email' ";
 	$dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
 	if ( $wpdb->get_var($dupe) )
-		die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
+		wp_die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
 
 	// Simple flood-protection
 	if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$comment_author_IP' OR comment_author_email = '$comment_author_email' ORDER BY comment_date DESC LIMIT 1") ) {
@@ -189,7 +189,7 @@
 		$time_newcomment  = mysql2date('U', $comment_date_gmt);
 		if ( ($time_newcomment - $time_lastcomment) < 15 ) {
 			do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
-			die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') );
+			wp_die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') );
 		}
 	}
 
Index: wp-includes/class-IXR.php
===================================================================
--- wp-includes/class-IXR.php	(revision 3984)
+++ wp-includes/class-IXR.php	(working copy)
@@ -149,7 +149,7 @@
         xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
         xml_set_character_data_handler($this->_parser, 'cdata');
         if (!xml_parse($this->_parser, $this->message)) {
-            /* die(sprintf('XML error: %s at line %d',
+            /* wp_die(sprintf('XML error: %s at line %d',
                 xml_error_string(xml_get_error_code($this->_parser)),
                 xml_get_current_line_number($this->_parser))); */
             return false;
@@ -275,7 +275,7 @@
         if (!$data) {
             global $HTTP_RAW_POST_DATA;
             if (!$HTTP_RAW_POST_DATA) {
-               die('XML-RPC server accepts POST requests only.');
+               wp_die('XML-RPC server accepts POST requests only.');
             }
             $data = $HTTP_RAW_POST_DATA;
         }
Index: wp-mail.php
===================================================================
--- wp-mail.php	(revision 3984)
+++ wp-mail.php	(working copy)
@@ -17,7 +17,7 @@
 endif;
 
 $count = $pop3->login(get_settings('mailserver_login'), get_settings('mailserver_pass'));
-if (0 == $count) die(__('There doesn&#8217;t seem to be any new mail.'));
+if (0 == $count) wp_die(__('There doesn&#8217;t seem to be any new mail.'));
 
 
 for ($i=1; $i <= $count; $i++) :
Index: wp-content/themes/default/images/header-img.php
===================================================================
--- wp-content/themes/default/images/header-img.php	(revision 3984)
+++ wp-content/themes/default/images/header-img.php	(working copy)
@@ -4,7 +4,7 @@
 
 // If we don't have image processing support, redirect.
 if ( ! function_exists('imagecreatefromjpeg') )
-	die(header("Location: kubrickheader.jpg"));
+	wp_die(header("Location: kubrickheader.jpg"));
 
 // Assign and validate the color values
 $default = false;
Index: wp-settings.php
===================================================================
--- wp-settings.php	(revision 3984)
+++ wp-settings.php	(working copy)
@@ -5,7 +5,7 @@
 		return;
 
 	if ( isset($_REQUEST['GLOBALS']) )
-		die('GLOBALS overwrite attempt detected');
+		wp_die('GLOBALS overwrite attempt detected');
 
 	// Variables that shouldn't be unset
 	$noUnset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix');
@@ -47,10 +47,10 @@
 	$_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]);
 
 if ( !(phpversion() >= '4.1') )
-	die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
+	wp_die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
 
 if ( !extension_loaded('mysql') )
-	die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
+	wp_die( 'Your PHP installation appears to be missing the MySQL which is required for WordPress.' );
 
 function timer_start() {
 	global $timestart;
@@ -111,7 +111,7 @@
 		$link = 'install.php';
 	else
 		$link = 'wp-admin/install.php';
-	die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
+	wp_die(sprintf(__("It doesn't look like you've installed WP yet. Try running <a href='%s'>install.php</a>."), $link));
 }
 
 require (ABSPATH . WPINC . '/formatting.php');
Index: wp-admin/inline-uploading.php
===================================================================
--- wp-admin/inline-uploading.php	(revision 3984)
+++ wp-admin/inline-uploading.php	(working copy)
@@ -5,7 +5,7 @@
 header('Content-Type: text/html; charset=' . get_option('blog_charset'));
 
 if (!current_user_can('upload_files'))
-	die(__('You do not have permission to upload files.'));
+	wp_die(__('You do not have permission to upload files.'));
 
 wp_reset_vars(array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'attachment'));
 
@@ -22,7 +22,7 @@
 check_admin_referer('inlineuploading');
 
 if ( !current_user_can('edit_post', (int) $attachment) )
-	die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
+	wp_die(__('You are not allowed to delete this attachment.').' <a href="'.basename(__FILE__)."?post=$post&amp;all=$all&amp;action=upload\">".__('Go back').'</a>');
 
 wp_delete_attachment($attachment);
 
@@ -38,7 +38,7 @@
 $file = wp_handle_upload($_FILES['image'], $overrides);
 
 if ( isset($file['error']) )
-	die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
+	wp_die($file['error'] . '<br /><a href="' . basename(__FILE__) . '?action=upload&post=' . $post . '">'.__('Back to Image Uploading').'</a>');
 
 $url = $file['url'];
 $type = $file['type'];
@@ -88,7 +88,7 @@
 }
 
 wp_redirect(basename(__FILE__) . "?post=$post&all=$all&action=view&start=0");
-die();
+wp_die();
 
 case 'upload':
 
@@ -276,7 +276,7 @@
 break;
 
 default:
-die(__('This script was not meant to be called directly.'));
+wp_die(__('This script was not meant to be called directly.'));
 }
 
 ?>
Index: wp-admin/update-links.php
===================================================================
--- wp-admin/update-links.php	(revision 3984)
+++ wp-admin/update-links.php	(working copy)
@@ -3,12 +3,12 @@
 require_once( ABSPATH . 'wp-includes/class-snoopy.php');
 
 if ( !get_option('use_linksupdate') )
-	die(__('Feature disabled.'));
+	wp_die(__('Feature disabled.'));
 
 $link_uris = $wpdb->get_col("SELECT link_url FROM $wpdb->links");
 
 if ( !$link_uris )
-	die('No links');
+	wp_die('No links');
 
 $link_uris = urlencode( join( $link_uris, "\n" ) );
 
Index: wp-admin/users.php
===================================================================
--- wp-admin/users.php	(revision 3984)
+++ wp-admin/users.php	(working copy)
@@ -128,13 +128,13 @@
 	}
 
 	if ( !current_user_can('edit_users') )
-		die(__('You can&#8217;t edit users.'));
+		wp_die(__('You can&#8217;t edit users.'));
 
 	$userids = $_POST['users'];
 	$update = 'promote';
 	foreach($userids as $id) {
 		if ( ! current_user_can('edit_user', $id) )
-			die(__('You can&#8217;t edit that user.'));
+			wp_die(__('You can&#8217;t edit that user.'));
 		// The new role of the current user must also have edit_users caps
 		if($id == $current_user->id && !$wp_roles->role_objects[$_POST['new_role']]->has_cap('edit_users')) {
 			$update = 'err_admin_role';
@@ -158,7 +158,7 @@
 	}
 
 	if ( !current_user_can('delete_users') )
-		die(__('You can&#8217;t delete users.'));
+		wp_die(__('You can&#8217;t delete users.'));
 
 	$userids = $_POST['users'];
 	$update = 'del';
@@ -166,7 +166,7 @@
 
 	foreach ( (array) $userids as $id) {
 		if ( ! current_user_can('delete_user', $id) )
-			die(__('You can&#8217;t delete that user.'));
+			wp_die(__('You can&#8217;t delete that user.'));
 
 		if($id == $current_user->id) {
 			$update = 'err_admin_del';
@@ -252,7 +252,7 @@
 	check_admin_referer('add-user');
 
 	if ( ! current_user_can('create_users') )
-		die(__('You can&#8217;t create users.'));
+		wp_die(__('You can&#8217;t create users.'));
 
 	$user_id = add_user();
 	$update = 'add';
@@ -262,7 +262,7 @@
 		$new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_POST['user_login']), true));
 		$redirect = add_query_arg('usersearch', $new_user_login, $redirect);
 		wp_redirect(add_query_arg('update', $update, $redirect) . '#user-' . $user_id);
-		die();
+		wp_die();
 	}
 
 default:
Index: wp-admin/profile-update.php
===================================================================
--- wp-admin/profile-update.php	(revision 3984)
+++ wp-admin/profile-update.php	(working copy)
@@ -7,7 +7,7 @@
 check_admin_referer('update-profile_' . $user_ID);
 
 if ( !$_POST )
-	die( __('No post?') );
+	wp_die( __('No post?') );
 
 $errors = edit_user($user_ID);
 
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 3984)
+++ wp-admin/post.php	(working copy)
@@ -117,14 +117,14 @@
 	$post = & get_post($post_id);
 
 	if ( !current_user_can('delete_post', $post_id) )
-		die( __('You are not allowed to delete this post.') );
+		wp_die( __('You are not allowed to delete this post.') );
 
 	if ( $post->post_type == 'attachment' ) {
 		if ( ! wp_delete_attachment($post_id) )
-			die( __('Error in deleting...') );
+			wp_die( __('Error in deleting...') );
 	} else {
 		if ( !wp_delete_post($post_id) ) 
-			die( __('Error in deleting...') );
+			wp_die( __('Error in deleting...') );
 	}
 
 	$sendback = wp_get_referer();
Index: wp-admin/theme-editor.php
===================================================================
--- wp-admin/theme-editor.php	(revision 3984)
+++ wp-admin/theme-editor.php	(working copy)
@@ -16,7 +16,7 @@
 
 
 if ( ! isset($themes[$theme]) )
-	die(__('The requested theme does not exist.'));
+	wp_die(__('The requested theme does not exist.'));
 
 $allowed_files = array_merge($themes[$theme]['Stylesheet Files'], $themes[$theme]['Template Files']);
 
@@ -36,7 +36,7 @@
 	check_admin_referer('edit-theme_' . $file . $theme);
 
 	if ( !current_user_can('edit_themes') )
-		die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
 
 	$newcontent = stripslashes($_POST['newcontent']);
 	$theme = urlencode($theme);
@@ -57,7 +57,7 @@
 
 	require_once('admin-header.php');
 	if ( !current_user_can('edit_themes') )
-		die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit themes for this blog.').'</p>');
 
 	update_recently_edited($file);
 
Index: wp-admin/admin.php
===================================================================
--- wp-admin/admin.php	(revision 3984)
+++ wp-admin/admin.php	(working copy)
@@ -45,11 +45,11 @@
 		do_action($page_hook);
 	} else {
 		if ( validate_file($plugin_page) ) {
-			die(__('Invalid plugin page'));
+			wp_die(__('Invalid plugin page'));
 		}
 
 		if (! file_exists(ABSPATH . "wp-content/plugins/$plugin_page"))
-			die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
+			wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
 
 		if (! isset($_GET['noheader']))
 			require_once(ABSPATH . '/wp-admin/admin-header.php');
@@ -65,11 +65,11 @@
 	$importer = $_GET['import'];
 
 	if ( validate_file($importer) ) {
-		die(__('Invalid importer.'));
+		wp_die(__('Invalid importer.'));
 	}
 
 	if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
-		die(__('Cannot load importer.'));
+		wp_die(__('Cannot load importer.'));
 
 	include(ABSPATH . "wp-admin/import/$importer.php");
 
Index: wp-admin/templates.php
===================================================================
--- wp-admin/templates.php	(revision 3984)
+++ wp-admin/templates.php	(working copy)
@@ -25,7 +25,7 @@
 	check_admin_referer('edit-file_' . $file);
 
 	if ( ! current_user_can('edit_files') )
-		die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
 
 	$newcontent = stripslashes($_POST['newcontent']);
 	if (is_writeable($real_file)) {
@@ -50,10 +50,10 @@
 	require_once('./admin-header.php');
 
 	if ( ! current_user_can('edit_files') )
-		die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
 
 	if ( strstr( $file, 'wp-config.php' ) )
-	die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
+	wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>');
 
 	update_recently_edited($file);
 
Index: wp-admin/admin-functions.php
===================================================================
--- wp-admin/admin-functions.php	(revision 3984)
+++ wp-admin/admin-functions.php	(working copy)
@@ -6,10 +6,10 @@
 
 	if ( 'page' == $_POST['post_type'] ) {
 		if ( !current_user_can('edit_pages') )
-			die(__('You are not allowed to create pages on this blog.'));
+			wp_die(__('You are not allowed to create pages on this blog.'));
 	} else {
 		if ( !current_user_can('edit_posts') )
-			die(__('You are not allowed to create posts or drafts on this blog.'));
+			wp_die(__('You are not allowed to create posts or drafts on this blog.'));
 	}
 
 	// Rename.
@@ -32,10 +32,10 @@
 	if ($_POST['post_author'] != $_POST['user_ID']) {
 		if ( 'page' == $_POST['post_type'] ) {
 			if ( !current_user_can('edit_others_pages') )
-				die(__('You cannot create pages as this user.'));
+				wp_die(__('You cannot create pages as this user.'));
 		} else {
 			if ( !current_user_can('edit_others_posts') )
-				die(__('You cannot post as this user.'));
+				wp_die(__('You cannot post as this user.'));
 
 		}
 	}
@@ -151,10 +151,10 @@
 
 	if ( 'page' == $_POST['post_type'] ) {
 		if ( !current_user_can('edit_page', $post_ID) )
-			die(__('You are not allowed to edit this page.'));
+			wp_die(__('You are not allowed to edit this page.'));
 	} else {
 		if ( !current_user_can('edit_post', $post_ID) )
-			die(__('You are not allowed to edit this post.'));
+			wp_die(__('You are not allowed to edit this post.'));
 	}
 
 	// Rename.
@@ -176,10 +176,10 @@
 	if ($_POST['post_author'] != $_POST['user_ID']) {
 		if ( 'page' == $_POST['post_type'] ) {
 			if ( !current_user_can('edit_others_pages') )
-				die(__('You cannot edit pages as this user.'));
+				wp_die(__('You cannot edit pages as this user.'));
 		} else {
 			if ( !current_user_can('edit_others_posts') )
-				die(__('You cannot edit posts as this user.'));
+				wp_die(__('You cannot edit posts as this user.'));
 
 		}
 	}
@@ -251,7 +251,7 @@
 	$comment_post_ID = (int) $_POST['comment_post_ID'];
 
 	if (!current_user_can('edit_post', $comment_post_ID))
-		die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
+		wp_die(__('You are not allowed to edit comments on this post, so you cannot edit this comment.'));
 
 	$_POST['comment_author'] = $_POST['newcomment_author'];
 	$_POST['comment_author_email'] = $_POST['newcomment_author_email'];
@@ -530,7 +530,7 @@
 
 function edit_link($link_id = '') {
 	if (!current_user_can('manage_links'))
-		die(__("Cheatin' uh ?"));
+		wp_die(__("Cheatin' uh ?"));
 
 	$_POST['link_url'] = wp_specialchars($_POST['link_url']);
 	$_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url'];
@@ -1521,13 +1521,13 @@
 
 	switch ($code) {
 		case 1 :
-			die(__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
+			wp_die(__('Sorry, can&#8217;t edit files with ".." in the name. If you are trying to edit a file in your WordPress home directory, you can just type the name of the file in.'));
 
 		case 2 :
-			die(__('Sorry, can&#8217;t call files with their real path.'));
+			wp_die(__('Sorry, can&#8217;t call files with their real path.'));
 
 		case 3 :
-			die(__('Sorry, that file cannot be edited.'));
+			wp_die(__('Sorry, that file cannot be edited.'));
 	}
 }
 
@@ -1844,7 +1844,7 @@
 	// Move the file to the uploads dir
 	$new_file = $uploads['path'] . "/$filename";
 	if ( false === @ move_uploaded_file($file['tmp_name'], $new_file) )
-		die(printf(__('The uploaded file could not be moved to %s.'), $file['path']));
+		wp_die(printf(__('The uploaded file could not be moved to %s.'), $file['path']));
 
 	// Set correct file permissions
 	$stat = stat(dirname($new_file));
Index: wp-admin/moderation.php
===================================================================
--- wp-admin/moderation.php	(revision 3984)
+++ wp-admin/moderation.php	(working copy)
@@ -21,7 +21,7 @@
 	check_admin_referer('moderate-comments');
 
 	if ( ! current_user_can('moderate_comments') )
-	die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
+	wp_die('<p>'.__('Your level is not high enough to moderate comments.').'</p>');
 
 	$item_ignored = 0;
 	$item_deleted = 0;
Index: wp-admin/comment.php
===================================================================
--- wp-admin/comment.php	(revision 3984)
+++ wp-admin/comment.php	(working copy)
@@ -19,10 +19,10 @@
 	$comment = (int) $_GET['comment'];
 
 	if ( ! $comment = get_comment($comment) )
-		die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
+		wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)'));
 
 	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
-		die( __('You are not allowed to edit comments on this post.') );
+		wp_die( __('You are not allowed to edit comments on this post.') );
 
 	$comment = get_comment_to_edit($comment);
 
@@ -42,10 +42,10 @@
 	$nonce_action .= $comment;
 
 	if ( ! $comment = get_comment($comment) )
-		die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+		wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
 
 	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
-		die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
+		wp_die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
 
 	echo "<div class='wrap'>\n";
 	if ( 'spam' == $_GET['delete_type'] )
@@ -90,13 +90,13 @@
 	}
 
 	$postdata = get_post($p) or 
-		die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+		wp_die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
 
 	if ( ! $comment = get_comment($comment) )
-			 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php'));
+			 wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php'));
 
 	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
-		die( __('You are not allowed to edit comments on this post.') );
+		wp_die( __('You are not allowed to edit comments on this post.') );
 
 	if ( 'spam' == $_REQUEST['delete_type'] )
 		wp_set_comment_status($comment->comment_ID, 'spam');
@@ -123,10 +123,10 @@
 	}
 
 	if ( ! $comment = get_comment($comment) )
-		die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+		wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
 
 	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
-		die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
+		wp_die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') );
 
 	wp_set_comment_status($comment->comment_ID, "hold");
 
@@ -150,10 +150,10 @@
 	}
 
 	if ( ! $comment = get_comment($comment) )
-		die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
+		wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
 
 	if ( !current_user_can('edit_post', $comment->comment_post_ID) )
-		die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
+		wp_die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
 
 	wp_set_comment_status($comment->comment_ID, "approve");
 	if (get_settings("comments_notify") == true) {
Index: wp-admin/import/blogger.php
===================================================================
--- wp-admin/import/blogger.php	(revision 3984)
+++ wp-admin/import/blogger.php	(working copy)
@@ -26,7 +26,7 @@
 	function restart() {
 		delete_option('import-blogger');
 		wp_redirect("admin.php?import=blogger");
-		die();
+		wp_die();
 	}
 
 	// Generates a string that will make the page reload in a specified interval.
@@ -160,7 +160,7 @@
 			else $status = "0%";
 			echo "\t<li><a href='admin.php?import=blogger&amp;noheader=true&amp;blog={$blog['id']}'>{$blog['title']}</a> $status</li>\n";
 		}
-		die("</ul>\n");
+		wp_die("</ul>\n");
 	}
 
 	// Publishes.
@@ -180,11 +180,11 @@
 				$response = $this->get_blogger($url, $this->import['cookies']);
 				preg_match('#<p class="progressIndicator">.*</p>#U', $response['body'], $matches);
 				$progress = $matches[0];
-				die($head . $progress);
+				wp_die($head . $progress);
 			} else {
 				$this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
 				update_option('import-blogger', $this->import);
-				die($head);
+				wp_die($head);
 			}
 		} else {
 			// Subsequent call. Keep checking status until Blogger reports publish complete.
@@ -196,11 +196,11 @@
 					$this->set_next_step($i);
 					$progress .= '<p>'.__('Moving on...').'</p>';
 				}
-				die($head . $progress);
+				wp_die($head . $progress);
 			} else {
 				$this->import['blogs'][$_GET['blog']]['publish'][$i] = false;
 				update_option('import-blogger', $this->import);
-				die("$head<p>" . __('Trying again...') . '</p>');
+				wp_die("$head<p>" . __('Trying again...') . '</p>');
 			}
 		}
 	}
@@ -214,7 +214,7 @@
 	// Redirects to next step
 	function do_next_step() {
 		wp_redirect("admin.php?import=blogger&noheader=true&blog={$_GET['blog']}");
-		die();
+		wp_die();
 	}
 
 	// Step 0: Do Blogger login, get blogid/title pairs.
@@ -241,7 +241,7 @@
 			$blogsary = array();
 			preg_match_all('#posts\.g\?blogID=(\d+)">([^<]+)</a>#U', $response['body'], $blogsary);
 			if ( ! count( $blogsary[1] < 1 ) )
-				die(__('No blogs found for this user.'));
+				wp_die(__('No blogs found for this user.'));
 			$this->import['blogs'] = array();
 			$template = '<MainPage><br /><br /><br /><p>'.__('Are you looking for %title%? It is temporarily out of service. Please try again in a few minutes. Meanwhile, discover <a href="http://wordpress.org/">a better blogging tool</a>.').'</p><BloggerArchives><a class="archive" href="<$BlogArchiveURL$>"><$BlogArchiveName$></a><br /></BloggerArchives></MainPage><ArchivePage><Blogger><wordpresspost><$BlogItemDateTime$>|W|P|<$BlogItemAuthorNickname$>|W|P|<$BlogItemBody$>|W|P|<$BlogItemNumber$>|W|P|<$BlogItemTitle$>|W|P|<$BlogItemAuthorEmail$><BlogItemCommentsEnabled><BlogItemComments><wordpresscomment><$BlogCommentDateTime$>|W|P|<$BlogCommentAuthor$>|W|P|<$BlogCommentBody$></BlogItemComments></BlogItemCommentsEnabled></Blogger></ArchivePage>';
 			foreach ( $blogsary[1] as $key => $id ) {
@@ -275,14 +275,14 @@
 			update_option('import-blogger', $this->import);
 			wp_redirect("admin.php?import=blogger&noheader=true&step=1");
 		}
-		die();
+		wp_die();
 	}
 
 	// Step 1: Select one of the blogs belonging to the user logged in.
 	function select_blog() {
 		if ( is_array($this->import['blogs']) ) {
 			$this->show_blogs();
-			die();
+			wp_die();
 		} else {
 			$this->restart();
 		}
@@ -306,7 +306,7 @@
 						if ( $_POST['publishMode'] > 0 ) {
 							$response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode=0", $headers);
 							if ( $response['code'] >= 400 )
-								die('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
+								wp_die('<h2>'.__('Failed attempt to change publish mode from FTP to BlogSpot.').'</h2><pre>' . addslashes(print_r($headers, 1)) . addslashes(print_r($response, 1)) . '</pre>');
 							$this->import['blogs'][$_GET['blog']]['url'] = 'http://' . $optary['modify']['subdomain'] . '.blogspot.com/';
 							sleep(2);
 						} else {
@@ -321,7 +321,7 @@
 					}
 					$response = $this->post_blogger($posturl, $headers, $paramary);
 					if ( $response['code'] >= 400 || strstr($response['body'], 'There are errors on this form') )
-						die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
+						wp_die('<p>'.__('Error on form submission. Retry or reset the importer.').'</p>' . addslashes(print_r($response, 1)));
 				}
 				$output .= "<del><p>$blog_opt</p></del>\n";
 			} elseif ( is_array($this->import['blogs'][$_GET['blog']]['options']["$blog_opt"]['backup']) ) {
@@ -347,7 +347,7 @@
 			}
 		}
 		if ( $form )
-			die($output . $form);
+			wp_die($output . $form);
 
 		$this->set_next_step(4);
 		$this->do_next_step();
@@ -364,7 +364,7 @@
 	function get_archive_urls() {
 		$bloghtml = $this->get_blogger($this->import['blogs'][$_GET['blog']]['url']);
 		if (! strstr($bloghtml['body'], '<a class="archive"') )
-			die(__('Your Blogger blog did not take the new template or did not respond.'));
+			wp_die(__('Your Blogger blog did not take the new template or did not respond.'));
 		preg_match_all('#<a class="archive" href="([^"]*)"#', $bloghtml['body'], $archives);
 		foreach ($archives[1] as $archive) {
 			$this->import['blogs'][$_GET['blog']]['archives'][$archive] = false;
@@ -520,7 +520,7 @@
  		}
 		if ( ! $did_one )
 			$this->set_next_step(7);
-		die( $this->refresher(1000) . $output );
+		wp_die( $this->refresher(1000) . $output );
 	}
 
 	// Step 7: Restore the backed-up settings to Blogger
@@ -546,7 +546,7 @@
 						$response = $this->get_blogger("http://www.blogger.com/blog-publishing.g?blogID={$_GET['blog']}&publishMode={$optary['backup']['publishMode']}", $headers);
 						sleep(2);
 						if ( $response['code'] >= 400 )
-							die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
+							wp_die('<h1>Error restoring publishMode.</h1><p>Please tell the devs.</p>' . addslashes(print_r($response, 1)) );
 					}
 				}
 				if ( $optary['backup'] != $optary['modify'] ) {
@@ -566,7 +566,7 @@
 		}
 
 		if ( $did_one ) {
-			die( $this->refresher(1000) . $output );
+			wp_die( $this->refresher(1000) . $output );
 		} elseif ( $this->import['blogs'][$_GET['blog']]['options']['blog-publishing']['backup']['publishMode'] > 0 ) {
 			$this->set_next_step(9);
 		} else {
@@ -615,7 +615,7 @@
 				$step = 0;
 			}
 //echo "Step $step.";
-//die('<pre>'.print_r($this->import,1).'</pre');
+//wp_die('<pre>'.print_r($this->import,1).'</pre');
 			switch ($step) {
 				case 0 :
 					$this->do_login();
Index: wp-admin/import/greymatter.php
===================================================================
--- wp-admin/import/greymatter.php	(revision 3984)
+++ wp-admin/import/greymatter.php	(working copy)
@@ -87,10 +87,10 @@
 		}
 
 		if (!chdir($archivespath))
-			die("Wrong path, $archivespath\ndoesn't exist\non the server");
+			wp_die("Wrong path, $archivespath\ndoesn't exist\non the server");
 
 		if (!chdir($gmpath))
-			die("Wrong path, $gmpath\ndoesn't exist\non the server");
+			wp_die("Wrong path, $gmpath\ndoesn't exist\non the server");
 			
 		$this->header();
 ?>
Index: wp-admin/menu.php
===================================================================
--- wp-admin/menu.php	(revision 3984)
+++ wp-admin/menu.php	(working copy)
@@ -118,7 +118,7 @@
 ksort($menu); // make it all pretty
 
 if (! user_can_access_admin_page()) {
-	die( __('You do not have sufficient permissions to access this page.') );
+	wp_die( __('You do not have sufficient permissions to access this page.') );
 }
 
 ?>
Index: wp-admin/link-import.php
===================================================================
--- wp-admin/link-import.php	(revision 3984)
+++ wp-admin/link-import.php	(working copy)
@@ -89,7 +89,7 @@
 					$file = wp_handle_upload($_FILES['userfile'], $overrides);
 
 					if ( isset($file['error']) )
-						die($file['error']);
+						wp_die($file['error']);
 
 					$url = $file['url'];
 					$opml_url = $file['file'];
Index: wp-admin/upgrade.php
===================================================================
--- wp-admin/upgrade.php	(revision 3984)
+++ wp-admin/upgrade.php	(working copy)
@@ -1,6 +1,6 @@
 <?php
 define('WP_INSTALLING', true);
-if (!file_exists('../wp-config.php')) die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
+if (!file_exists('../wp-config.php')) wp_die("There doesn't seem to be a wp-config.php file. Double check that you updated wp-config-sample.php with the proper database connection information and renamed it to wp-config.php.");
 require('../wp-config.php');
 timer_start();
 require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
Index: wp-admin/link.php
===================================================================
--- wp-admin/link.php	(revision 3984)
+++ wp-admin/link.php	(working copy)
@@ -18,7 +18,7 @@
 
 		// check the current user's level first.
 		if (!current_user_can('manage_links'))
-			die(__("Cheatin' uh ?"));
+			wp_die(__("Cheatin' uh ?"));
 
 		//for each link id (in $linkcheck[]) change category to selected value
 		if (count($linkcheck) == 0) {
@@ -42,7 +42,7 @@
 
 		// check the current user's level first.
 		if (!current_user_can('manage_links'))
-			die(__("Cheatin' uh ?"));
+			wp_die(__("Cheatin' uh ?"));
 
 		//for each link id (in $linkcheck[]) change category to selected value
 		if (count($linkcheck) == 0) {
@@ -79,7 +79,7 @@
 		check_admin_referer('delete-bookmark_' . $link_id);
 
 		if (!current_user_can('manage_links'))
-			die(__("Cheatin' uh ?"));
+			wp_die(__("Cheatin' uh ?"));
 
 		wp_delete_link($link_id);
 
@@ -95,12 +95,12 @@
 		$title = __('Edit Bookmark');
 		include_once ('admin-header.php');
 		if (!current_user_can('manage_links'))
-			die(__('You do not have sufficient permissions to edit the bookmarks for this blog.'));
+			wp_die(__('You do not have sufficient permissions to edit the bookmarks for this blog.'));
 
 		$link_id = (int) $_GET['link_id'];
 
 		if (!$link = get_link_to_edit($link_id))
-			die(__('Link not found.'));
+			wp_die(__('Link not found.'));
 
 		include ('edit-link-form.php');
 		break;
Index: wp-admin/setup-config.php
===================================================================
--- wp-admin/setup-config.php	(revision 3984)
+++ wp-admin/setup-config.php	(working copy)
@@ -2,11 +2,11 @@
 define('WP_INSTALLING', true);
 
 if (!file_exists('../wp-config-sample.php'))
-    die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
+    wp_die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
 
 $configFile = file('../wp-config-sample.php');
 
-if (!is_writable('../')) die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
+if (!is_writable('../')) wp_die("Sorry, I can't write to the directory. You'll have to either change the permissions on your WordPress directory or create your wp-config.php manually.");
 
 
 if (isset($_GET['step']))
@@ -78,7 +78,7 @@
 <?php
 // Check if wp-config.php has been created
 if (file_exists('../wp-config.php'))
-	die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p></body></html>");
+	wp_die("<p>The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>.</p></body></html>");
 
 switch($step) {
 	case 0:
Index: wp-admin/link-manager.php
===================================================================
--- wp-admin/link-manager.php	(revision 3984)
+++ wp-admin/link-manager.php	(working copy)
@@ -22,7 +22,7 @@
 include_once ("./admin-header.php");
 
 if (!current_user_can('manage_links'))
-	die(__("You do not have sufficient permissions to edit the bookmarks for this blog."));
+	wp_die(__("You do not have sufficient permissions to edit the bookmarks for this blog."));
 
 switch ($order_by) {
 	case 'order_id' :
Index: wp-admin/install.php
===================================================================
--- wp-admin/install.php	(revision 3984)
+++ wp-admin/install.php	(working copy)
@@ -1,7 +1,7 @@
 <?php
 define('WP_INSTALLING', true);
 if (!file_exists('../wp-config.php')) 
-    die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
+    wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
 
 require_once('../wp-config.php');
 require_once('./upgrade-functions.php');
@@ -74,7 +74,7 @@
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 <?php
 // Let's check to make sure WP isn't already installed.
-if ( is_blog_installed() ) die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
+if ( is_blog_installed() ) wp_die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p></body></html>');
 
 switch($step) {
 
Index: wp-admin/page.php
===================================================================
--- wp-admin/page.php	(revision 3984)
+++ wp-admin/page.php	(working copy)
@@ -110,14 +110,14 @@
 	$page = & get_post($page_id);
 
 	if ( !current_user_can('delete_page', $page_id) )
-		die( __('You are not allowed to delete this page.') );
+		wp_die( __('You are not allowed to delete this page.') );
 
 	if ( $page->post_type == 'attachment' ) {
 		if ( ! wp_delete_attachment($page_id) )
-			die( __('Error in deleting...') );
+			wp_die( __('Error in deleting...') );
 	} else {
 		if ( !wp_delete_post($page_id) ) 
-			die( __('Error in deleting...') );
+			wp_die( __('Error in deleting...') );
 	}
 
 	$sendback = wp_get_referer();
Index: wp-admin/plugin-editor.php
===================================================================
--- wp-admin/plugin-editor.php	(revision 3984)
+++ wp-admin/plugin-editor.php	(working copy)
@@ -23,7 +23,7 @@
 	check_admin_referer('edit-plugin_' . $file);
 
 	if ( !current_user_can('edit_plugins') )
-		die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>');
 
 	$newcontent = stripslashes($_POST['newcontent']);
 	if (is_writeable($real_file)) {
@@ -43,7 +43,7 @@
 
 	require_once('admin-header.php');
 	if ( !current_user_can('edit_plugins') )
-		die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
+		wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
 
 	update_recently_edited("wp-content/plugins/$file");
 
Index: wp-admin/categories.php
===================================================================
--- wp-admin/categories.php	(revision 3984)
+++ wp-admin/categories.php	(working copy)
@@ -31,10 +31,10 @@
 
 	// Don't delete the default cats.
     if ( $cat_ID == get_option('default_category') )
-		die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+		wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
     if ( $cat_ID == get_option('default_link_category') )
-		die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
+		wp_die(sprintf(__("Can't delete the <strong>%s</strong> category: this is the default one for bookmarks"), $cat_name));
 
 	wp_delete_category($cat_ID);
 
