• Resolved selnomeria

    (@selnomeria)


    Many developers need to enable WP_DEBUG constant, but modyfing wp-config.php is ver inconvenient.. so, i have an idea…

    in wp-config.php (or somewhere you know better) there should be a functionality,to do the following:

    Let’s say, when I access site with parameter:
    mysite.com/?debug=on
    then :
    1) check if i am admin ( or paragraph doesnt matter )
    2) ask me confirmation message: Warning? Are you sure you really want to enable debug?

    if yes, then set special cookie for me … and re-direct to the homepage..
    After that, whenever WP sees that i have that cookie, then enable WP_DEBUG + WP_DEBUG_DISPLAY for me ( BUT that should be enabled ONLY when the front-end is accessed… for /wp-admin/, dont enable them..)

    I should be able DISABLE that using:
    mysite.com/?debug=off

Viewing 9 replies - 1 through 9 (of 9 total)
  • Many developers need to enable WP_DEBUG constant, but modyfing wp-config.php is ver inconvenient.. so, i have an idea…

    Frankly, it’s just much safer and simpler for developers – as well as the average user – to change define('WP_DEBUG', false); – to – define('WP_DEBUG', true); in your wp-config.php file when you need to debug. It’s literally a ten second job using your ftp client.

    However; There is also a multitude of related plugins already available that can assist you with debugging if editing wp-config.php manually is something you really don’t care to do.

    https://www.ads-software.com/plugins/search.php?q=debug

    Thread Starter selnomeria

    (@selnomeria)

    those plugins are USELESS!!
    if i ENABLE that, and there is shown any error, then i CANT disable them, using those plugins!!! (because, the shown error might EXIT loading..)

    so, the only solution is what i have described.

    That’s one of the reasons why the safest and simplest method to debug is by just changing define('WP_DEBUG', false); – to – define('WP_DEBUG', true); in your wp-config.php file when you need to debug. That is why the constant exists.

    But your idea would make a great plugin! You should tackle that and see what you can come up with. ??

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    There’s another reason to not do this: if you are enabling debug then you should know what you are doing.

    Editing wp-config.php isn’t that hard and most users shouldn’t enable that option carelessly.

    if i ENABLE that, and there is shown any error, then i CANT disable them, using those plugins!!! (because, the shown error might EXIT loading..)

    Then you most likely shouldn’t be enabling that feature. ??

    Thread Starter selnomeria

    (@selnomeria)

    FTP mode is not good choice.
    for example,i am on a PC (or another dvice), where i cant enter FTP client. so, the plugin may be a good idea. I will try to build that plugin.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    FTP mode is a horrible choice, on most systems I would recommend ssh and vi. That’s not for everyone but again, if you are going to enable debug then you should be comfortable with that level of access.

    Hi @selnomeria

    If you want to achieve this you can use what I have been using for about a year now. It does exactly what you are asking, minus the confirmation screen, etc. It just enables the errors to be displayed by a query. I use this consistently now. I started using it because the query will allow you to display the errors even when you have a blank white screen, which is ideal I think in that case. I hate blank white screens ??

    See the below… which I keep in my wp-config.php

    NOTE: Mine of course is a little different as to not give mine out.
    NOTE: I wouldn’t recommend keeping this on, on a production site, but that is up to you. If you keep it on I would recommend making the “on” much more unique. Either way you should be able to see the errors from your other devices when you don’t have FTP.

    // define('WP_DEBUG', true);
    // ?debug=on
    // (use at the end of the url to display errors on blank white screens)
    
    if (isset($_GET['debug']) && $_GET['debug']=='on') {
    	error_reporting(E_ALL); ini_set('display_errors', 1);
        define('WP_DEBUG', true);
    }
    Thread Starter selnomeria

    (@selnomeria)

    thanks Noahj Champion , i have done something similar that, editing WP-CONFIG>..
    however, my desire was without touching wp-config…

    No problem. It may server to help someone else then.

    Thanks for the update. Appreciate it.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘enable WP_DEBUG with a url’ is closed to new replies.