Title: custom comment error page
Last modified: August 18, 2016

---

# custom comment error page

 *  Resolved [2046](https://wordpress.org/support/users/o-o/)
 * (@o-o)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/custom-comment-error-page/)
 * hello,
 * does anyone know how to make custom comment error page.
    Because when people 
   don’t fill all required fields in the comment form, they receive a page with 
   WordPress logo and text such as “Error: please fill the required fields (name,
   email).”
 * But not all of them understand that the system is based on WordPress and when
   they see the WordPress logo they are confused. They see any similarities with
   previous site.
 * thanks for help jm

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [lokjah](https://wordpress.org/support/users/lokjah/)
 * (@lokjah)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535783)
 * I’m trying to find information on that as well, I’m wondering if theres a way
   to modify the 404 template to accommodate all of the possible errors, user and
   server?
 *  [lokjah](https://wordpress.org/support/users/lokjah/)
 * (@lokjah)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535791)
 * bump
 * looking in comments-post.php which is the page that loads displaying the comment
   error, I dont see anywhere to customize that.
 * and viewing the source of that page it has a reference to the wp-admin/install.
   css, it appears that the comment error is using a wp admin error page, have no
   idea if thats correct, but am also confused as to why its set up like it is.
 *  [lokjah](https://wordpress.org/support/users/lokjah/)
 * (@lokjah)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535799)
 * man this place is a ghost town. trying one last time
 *  [kprensac](https://wordpress.org/support/users/kprensac/)
 * (@kprensac)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535835)
 * This issue drove me crazy. It seems like it should be obvious. The answer, I 
   think, is to edit /wp-includes/functions.php more or less between lines 1258 
   and 1275 (it s in a function called wp_die() )
 *  [kevinobvious](https://wordpress.org/support/users/kevinobvious/)
 * (@kevinobvious)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535837)
 * I didn’t find an answer to this either so I made one. Using what kprensac said
   as a hint I started looking through wp-includes/functions.php and here’s what
   I did.
 * I inserted the following code inside the wp_die() function just before it starts
   outputting the html for the error page. Its two lines before the “<!DOCTYPE html
   PUBLIC” stuff. For me, I have version 2.3.1 which made the line number 1259 (
   I’m not sure about other versions of wordpress). Here’s the code I added.
 *     ```
       $templatedir = get_template_directory();
       if ( file_exists($templatedir.'/die.php') ){
       	include($templatedir.'/die.php');
       	die();
       }
       ```
   
 * This will check for a “die.php” file in your template directory and use that 
   for the error page if it finds it. Otherwise, it will use the built in wordpress
   one.
 * At some point inside the die.php file you will need to print the contents of 
   the “$message” variable. That variable contains the actual error message.
 * I ended up copying my single.php to die.php and edited things from there.
 *  [kevinobvious](https://wordpress.org/support/users/kevinobvious/)
 * (@kevinobvious)
 * [18 years, 6 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535838)
 * One small “oops”. The code above doesn’t work for admin pages. If you wrap the
   above code in a “functions_exists” block you should be good to go:
 *     ```
       if (function_exists('get_template_directory')){
       	$templatedir = get_template_directory();
       	if ( file_exists($templatedir.'/die.php') ){
       		include($templatedir.'/die.php');
       		die();
       	}
       }
       ```
   
 *  [stealthdave](https://wordpress.org/support/users/stealthdave/)
 * (@stealthdave)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535844)
 * Thank you for saving me several hours of development time! Have you submitted
   this patch to the developers yet? It’s very simple, clean, and addresses what
   is, in my opinion, one of WordPress’ biggest weak points, error management. On
   an enterprise site, even a blog, you_never_ want to see a default error message.
 *  [kprensac](https://wordpress.org/support/users/kprensac/)
 * (@kprensac)
 * [18 years, 4 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535847)
 * Thank you Kevin for the excellent solution. I agree with Dave that this should
   be part of the core build.
 *  [pauldm](https://wordpress.org/support/users/pauldm/)
 * (@pauldm)
 * [18 years, 3 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535851)
 * I am struggling to get this to work and cannot find a solution. I have copied
   the code as per above and have created a die.php file in my template directory(
   it is a direct copy of single.php with no amendments but I assume that does not
   matter – as long as there is a file to pull)
 * I get a 500 internal server error. I can’t understand why. Has anyone else had
   this problem? I am desperate for a solution as I thought it would be so easy 
   to fix.
 * I am running wordpress 2.3.3
 * Many thanks

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘custom comment error page’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 6 participants
 * Last reply from: [pauldm](https://wordpress.org/support/users/pauldm/)
 * Last activity: [18 years, 3 months ago](https://wordpress.org/support/topic/custom-comment-error-page/#post-535851)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
