WordPress: Using Conditional Tags in Plug-ins
I’ve been developing a WordPress plug-in for the Holidays (more on this at a later date) and I found something interesting. When plug-ins are loaded, the conditional tags (is_home, is_page, etc.) are effectively useless because the requested URL hasn’t been parsed yet. This was a problem for me because I wanted to be able to only have the script do its magic on the home page (by checking is_front_page). I did some searching but didn’t really find anything helpful. I even looked at the definition of is_front_page in the source code, which simply confirmed that it wouldn’t return accurate results when the plug-in was loaded. I finally thought of a good way to fix this… an action hook.