By default, if you want to enable Debug Mode on WordPress, you have to access to wp-config.php file (via FTP…) to edit this line of code:

define('WP_DEBUG', false);

to this one

define('WP_DEBUG', true);

By applying this little trick, you can access Debug Mode without editing wp-config.php over and over to turn on and off debug mode.

Replace above line of code with this snippet:

if ( isset($_GET['debug']) && $_GET['debug'] == 'on') define('WP_DEBUG', true);

From now on, each time you want to enable Debug Mode to check PHP errors on your site, just add /?debug=on at the end of your URL like this: https://wp-snippets.net/snippet/smarter-way-to-enable-debug-in-wordpress/?debug=on

P.S: In order to secure your trick, you could change debug to soMEthing like this

if ( isset($_GET['soMEthing']) && $_GET['soMEthing'] == 'on') define('WP_DEBUG', true);

Then this is your URL to turn Debug On: https://wp-snippets.net/snippet/smarter-way-to-enable-debug-in-wordpress/?soMEthing=on

 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x