Suppress PHP error details on a live website

I am sorry that this is such an amateur question, but so far I haven’t been able to find definitive answers on my own.

This has been my first-time working with WP and PHP, and I have already built my own WP website and plugin that involve database customization using Local on my PC. When I had unhandled errors with my plugin during the development, PHP exception details were shown on my web pages (not on the dashboard), so I used XDebug+VSCode, debugged the errors and didn’t think much of the error reporting mechanism itself.

Now I am close to launch my website, it dawned on me that I don’t know exactly how to turn my website and plugin into “production” mode, partly because I realized ‘WP_DEBUG’ had been set to FALSE all along for my website during the development.

Do I see those PHP error details while developing on Local, only because I am on Local? Once I go live with my site with a web hosting company, my website visitors won’t see those PHP error details, or is there anything else I have to do other than setting the variables in wp-config.php?
Also if unhandled PHP errors are suppressed for users, then what will they see? Will WP just show a generic “something went wrong” message, and users can just go back?

I feel very dumb asking these questions, but I’d really appreciate if someone could educate me.

Thank you,

Hi @kenguiche! It might depend on where you move your site to after Local, so it’s always a good idea to check your host’s documentation or ask their support for further insight. That being said I’m not aware of a host that would enable your WP_DEBUG by default :thinking:. As long as you have access to edit your wp-config.php you should be fine. Or some hosts like Flywheel have a built-in toggle for it right on their dashboard: Flywheel | How do I turn on WP_DEBUG?

So once your site is live, if WP_DEBUG is enabled, users might see error messages on the front end. If it’s disabled then those won’t appear, but if you have access to your site’s error logs you can see and use those to check for any issues. That’s why it’s better to troubleshoot plugins, themes, and versioning, in something like Local! If your site happens to go down due to a fatal error with a plugin or theme, if WP_DEBUG is disabled they’ll likely just see a message to the tune of “There has been a critical error on this website”.

1 Like

Thank you very much for your reply and the information.

1 Like

Hi @kenguiche - did Nick’s response above answer your question?

If so, I will close out this topic, please feel free to create a new one as needed.

Sam