[wp-hackers] substitutes for hook wp_footer ?

Ozh ozh at planetozh.com
Thu Jan 24 15:42:20 GMT 2008


Hello there

A long run question I think amongst plugin devs: is there a way you can 
make sure something has been triggered by, say, wp_footer hook?

If you want to be compatible with those pesky themes that miss their 
do_action('wp_footer')), would the following be acceptable ?

function myplugin_dostuff() {
        global $been_done;
        if ($been_done) return;
        // do stuff
        // ...
        $been_done = true;
}

add_action('wp_footer', 'myplugin_dostuff');
add_action('shutdown', 'myplugin_dostuff');

The obvious downside is that it would add output (like <script 
src="..."></script>) probably /after/ the closing </html> tag, but is 
there any better way to do things?

Thanks for any idea you'd have.

Ozh


More information about the wp-hackers mailing list