How to enable wordpress debug but only admin can see it? I finally found solution from one of my favorit SEO plugin developer Yoast, visit his site. Wordpress is actually built with debugging capability. You can enable it by changing WP debug value from false to true, the code can be found in wp-config.php file in Wordpress root folder. But apparently this debugging method is not safe, your visitor will be able to see it. You don't know there might be "criminal minded" are watching around. Coz sometime, crime occurs not only by intentions but opportunity, LOL.
So, how to hide wordpress debug and only visible to admin? Follow these 3 simple steps:
So, how to hide wordpress debug and only visible to admin? Follow these 3 simple steps:
- Open wp-config.php file in your wordpress root.
- Replace old wordpress default debug code:
define('WP_DEBUG', false);
with this code:
if (isset($_GET['debug']) && $_GET['debug'] == 'ghost')
define('WP_DEBUG', true); - That's it, done! To enable the debug, simply add "?debug=ghost" (no quote) to the end of every URL you wish to check:
http://mywpsite.com/?debug=ghost
http://mywpsite/my-post.html?debug=ghost
so on and so forth...