[wp-hackers] Getting the entire HTML page generated from WordPress
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
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.
> 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
> On 2/6/2012 2:26 PM, Mario Peshev wrote:
>> I've tried one solution from stackexchange:
>> Didn't seem to work though
> wp-hackers mailing list
> wp-hackers at lists.automattic.**com <wp-hackers at lists.automattic.com>
More information about the wp-hackers