How To: Display Error Messages in WordPress

One question we get a lot at WebDevStudios is what to do when you receive the dreaded WordPress White Screen of Death. WordPress by default hides all error messages from displaying. This is for security reasons as error messages can actually help hackers penetrate your website.

So how do you display error messages in WordPress? Easy! Just add the line of code below to the top of your .htaccess file in the root directory of your WordPress website.

php_flag display_errors on

That’s it! Error messages will now display across your entire WordPress website.

Another method used to display WordPress error messages is the WP_DEBUG flag:

define(‘WP_DEBUG’, true);

Just drop that line of code in your wp-config.php file and errors will start displaying.

Remember to only use these techniques to help troubleshoot errors and remove it as soon as you are done.

This entry was posted in How To, WordPress, WordPress Multisite and tagged , , . Bookmark the permalink.

17 Responses to How To: Display Error Messages in WordPress

  1. Pingback: Displaying Error Messages in WordPress — WPCandy — WordPress Themes, Plugins, Tips, and Tricks

  2. Stacy says:

    Do you have any idea how many hours could have been saved had I known this years ago?!? Thanks for the tip!

  3. Pingback: Abilitiamo i messaggi di errore in Wordpress! - Geekissimo

  4. Pingback: Como mostrar los mensajes de error de WordPress | Ayuda WordPress

  5. Pingback: Displaying Error Messages in WordPress « Internet Turnkey Websites

  6. Pingback: SoftHelp » Blog Archive » WordPress: Plugins, Themes, Tipps & Tricks Collection.

  7. NetWebLogic says:

    Good tutorial, although for clarification purposes I would say you should add “Run-time” to the description of this, because you are talking about displaying php error messages.
    Thanks

  8. very helpful …

    I also have a web site having problems online 1045 …

    but can be overcame …

    thank you …

    do not forget to visit the it.alonearea.com

  9. Pingback: Habilitar mensajes de error en Wordpress | Eliseos.net

  10. Al-rnymm says:

    Best Wishes For a Happy New Year.

  11. Rumio says:

    Thanks for an excellent article. .htaccess solution didn’t work for me as I got internal server error due to my server running in CGI mode. I then had to add the following lines in wp-config.php:

    define(‘WP_DEBUG’, true);
    @ini_set(‘log_errors’,’On’);
    @ini_set(‘display_errors’,’On’);
    @ini_set(‘error_log’,’/home/yourdefinedpath/phperrors.log’);

    I then created a file phperrors.log and uploaded it to the webserver.

    I found the path to phperrors.log by creating another path.php file and putting the following code in it:

  12. Rumio says:

    Sorry the code is:

    echo $_SERVER[‘DOCUMENT_ROOT’]

    Please put a “;” at the end of above statement and enclose it in php brackets.

  13. suman says:

    thanks bro

  14. Juergen says:

    Thanks
    you really made my day
    I never realized that there was a build in debug method in wordpress until I searched for it in Google

  15. Waqar says:

    Nice article.

    Though, I was more interested in Displaying Error Messages in WordPress when forms are submitted in administration. Your current post is more focused on PHP Error messages and not pure WordPress error messages. Any thoughts?

    Thanks

  16. Edwin says:

    I am not sure where to place the .htaccess file, should it same directory as the index.php?
    Btw, I m looking for pop up an alert box.

Comments are closed.