[wp-hackers] hook availability

Robert Deaton false.hopes at gmail.com
Sun Jan 8 21:18:16 GMT 2006

On 1/8/06, Amit Gupta <wp at igeek.info> wrote:
> is there a way by which a plugin can check whether a hook is available or
> not?
> I mean something along the lines of PHP's function_exists() function
> which I think would go quite a bit in helping plugin authors create
> backward compatible plugins and/or check whether the hook/filter
> they want exists or not & display appropriate message to the
> user incase the hook/filter is not available.

There are really only two ways to do this right now.

A) Check against the version, which is stored in a file, and output
your messages accordingly.

B) Have your plugin make dummy functions to run at the hooks you want
to check against. On shutdown, if your functions haven't been run, you
know that hook isn't available in the codeflow of the page you are
visiting (I say this because obviously certain hooks aren't always

--Robert Deaton

More information about the wp-hackers mailing list