[wp-hackers] Getting the entire HTML page generated from WordPress

Mario Peshev mario at peshev.net
Mon Feb 6 19:58:39 UTC 2012

Sure, I can do it in index.php or the wp-blog-header file, but I don't feel
that suicidal yet :)

Will try this out, thanks. I remember having some problems with the
shutdown hook, but it should work for normal posts and standard post types
I believe.


Mario Peshev
Training and Consulting Services @ DevriX

On Mon, Feb 6, 2012 at 9:53 PM, Brian Layman <wp-hackers at thecodecave.com>wrote:

> That looks like it's the right idea..
> The basic paradigm is:
> Somewhere very early on do
> ob_end_clean(); // Ensure a clean buffer.
> ob_start();
> On the "wp" or "init" action should be fine.
> Then, as the very last thing you do, capture, process and echo the results
> $body = ob_get_contents();
> ob_end_clean();  // Clear the results so the unaltered stuff isn't sent
> echo makeItBetter($body);
> Perhaps in the "shutdown" action. (I've heard rumors of times shutdown is
> not called, I have no specifics on that. That may just have been when a
> die() was hit.)
> Headers, if you need them, can be gotten through $headers = headers_list();
> You could even do this code before and after the wp stuff in the main
> index.php, but you're likely to be slapped in the face with a large trout
> if you try something as hackish as that.
> Hope that helps,
> Brian Layman
> http://eHermitsInc.com
> On 2/6/2012 2:26 PM, Mario Peshev wrote:
>> I've tried one solution from stackexchange:
>> http://wordpress.**stackexchange.com/a/41351/**11506<http://wordpress.stackexchange.com/a/41351/11506>
>> Didn't seem to work though
>>  ______________________________**_________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com>
> http://lists.automattic.com/**mailman/listinfo/wp-hackers<http://lists.automattic.com/mailman/listinfo/wp-hackers>

More information about the wp-hackers mailing list