Support

Account

Home Forums Gutenberg How to Debug… Reply To: How to Debug…

  • When you say that wp debug give no help, you are not seeing PHP errors in the debug log at all?

    Or are the coding errors things that do not create an a PHP error (for example in infinite loop that just times out the server) and therefore don’t log errors in the error log?

    If it’s the second case, this is always a problem when working with AJAX or REST or whatever you want to popular term is :P, and you need to get some output to see what’s going on. One solution is to log an error yourself.

    Some examples:

    If I just want to see if my code gets to a specific place before it dies

    
    error_log('Got Here');
    

    let’s say that I want to see what the value of some array is during execution:

    
    ob_start(); print_r($array); error_log(ob_get_clean());