[wp-hackers] Adding an output buffer callback

Eric Marden wp at xentek.net
Mon Nov 2 05:10:26 UTC 2009


On Nov 1, 2009, at 11:41 PM, William Canino wrote:
> I want to improve this by preg_match_replace-ing the whole page
> output.  I have written a function ga_link() that modifies hyperlinks
> to insert this tracking code.
>
> I would like advice on where to best call ob_start('ga_link') and
> ob_end_flush().


You might want to do that on wp_head and wp_footer actions.

That way you pretty much get everything between the body tags, which  
is all you care about anyway.

More:
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_footer

Though this seems like an awful lot of processing just to tag outbound  
links. Some of the ones you mentioned might be best served being done  
in the theme layer or hard coded.


- Eric Marden
__________________________________
http://xentek.net/code/wordpress/







More information about the wp-hackers mailing list