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?