Hi I'm using XDEBUG to debug my WordPress code, is it possible to view the page building up in the browser while debugging? At the moment the page just hangs until the debugging process is finished then displays the fully rendered page. Ideally I'd like to see the page building up bit by bit as I debug through the theme's code.

  • 1
    Depending on your IDE, you should be able to just step into/over the code and your breakpoints, and the output will be sent to the browser at the normal times during script execution. You can also use your IDE to watch variables and see their values.
    – Ian Dunn
    Feb 12, 2013 at 18:19

2 Answers 2


Just an Idea - I did not test this.

Worth a try would be to play around with your PHP settings:

; Implicit flush tells PHP to tell the output layer to flush itself      
; automatically after every output block. This is equivalent to calling the PHP   
; function flush() after each and every call to print() or echo() and each and 
; every HTML block. Turning this option on has serious performance implications 
; and is generally recommended for debugging purposes only. 
implicit_flush = On

I would also recommend to disable gzip and look for other output_buffering related options in php.ini.

Then you should be able to set break-points in the different rendering stages of your theme.

  • Thanks will try this. Judging by the lack of feedback on this question I understand that most developers do not do the kind of debugging I want to do. Most seem to be content with having the full page output at once. I think WordPress itself implements some caching which could complicate things.
    – urok93
    Jul 12, 2012 at 23:49
  • I'm not a Wordpress Developer, but its not clear what you want to archive, do you want an idea when some code is executed? For this I'd use the xdebug profiler feature with kcachegrind, which gives you a nice call tree. For the flushing question, there could a lot of other factors play a role beside PHP itself, maybe the browser or a webserver. Jul 14, 2012 at 12:52
  • As for caching, this should not matter as caching in Wordpress (without any 3rd-party plugins) is mostly a shortcut for time intensive queries and is only used punctual. It should not interfere with theme rendering or you should notice in the theme source-code. Jul 14, 2012 at 12:54
  • @urok93 It's not that most developers do not do the kind of debugging you want to do, but you never mentioned using breakpoints in your OP. Do you want to watch the actual page as it's built? Well I'm afraid that's not gonna happen, but if you wish to observer the code as it builds the page, why aren't you using breakpoints? Or are they not working? If not, you should edit your question to make that clear.
    – ProfK
    Nov 8, 2017 at 13:37

You can also change the output_buffering parameter in php.ini file to zero(0).

output_buffering = 0
  • 1
    "This answer was automatically flagged as low-quality because of its length and content", which I am sure you don't want. Can you provide a bit of an explanation of what this code does and why it might solve the problem.
    – s_ha_dum
    May 3, 2013 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.