PHP output buffering (2 posts)

  1. schvenk
    Posted 10 years ago #

    I'm trying to use PHP output buffering with WordPress and am running into trouble.

    Initially I had my server configured to run a PHP script before and after WordPress via auto_prepend_file and register_shutdown_function. The prepend script called ob_start, and the shutdown function called ob_get_contents(). Turns out, however, that PHP won't let you work with output buffers in a shutdown function...the contents are flushed before the function is called.

    The other option is to call an append script via auto_append_file. This works, except that I have to edit the WordPress installation's template-loader.php file and eliminate all its calls to exit(). So far that doesn't seem to break anything, but I'd rather not edit my WordPress install, since that complicates updates and such. Any suggestions?

  2. Jon Bourne
    Posted 9 years ago #

    Can anyone offer insight as to why removing all calls to exit() in template_loader.php is necessary? Or why they are there in first place?

    I am running into this same problem. I would like to wrap my caching system into a plugin, both to ease upgrades and so that others may use it, but I can't get over this one hurdle.

Topic Closed

This topic has been closed to new replies.

About this Topic