I want to create custom message when site got any error or broken or it is also be helpful if I can redirect site url to my custom page when site got error for example "www.demo" to "www.demo/custom-error-message-page" where I can display my message to visitors and also want those error to notify in my email.
I have tried wp_debug in wp-config to set to true but it shows all error on all pages of site instead that I only want any custom message to show.
Thanks
I want to create custom message when site got any error or broken or it is also be helpful if I can redirect site url to my custom page when site got error for example "www.demo.com" to "www.demo.com/custom-error-message-page" where I can display my message to visitors and also want those error to notify in my email.
I have tried wp_debug in wp-config to set to true but it shows all error on all pages of site instead that I only want any custom message to show.
Thanks
Now, that's actually pretty easy. Just create a 404.php
and a 403.php
and maybe a custom-error.php
Then you can setup your .htaccess
with something like this:
ErrorDocument 500 /custom-error.php
ErrorDocument XXX /custom-error.php
Please remember: you do not need that for the 404 and 403 as these are actually supported by the Wordpress Codex. For further Informations feel free to read the codex. Inside of the .php file you can do whatever.
--
Codex: https://codex.wordpress.org/Creating_an_Error_404_Page
Additional: https://premium.wpmudev.org/blog/customize-error-pages-wordpress/