How to check if an action is already fired in a function for example:
function foo() {
// checking if the action 'wp' is fired
if( !action_fired('wp') ) {
trigger_error('invalid call');
return;
}
if( is_front_page() ) {
// Do something
}
}
I want to check that because:
WordPress conditional tags like
is_front_page
won't work being called before the 'wp' hook.Still, these conditional tags can be called before 'wp' without any warning or notices
So writing a function like foo()
, I want to ensure it is called properly by throwing an error if the 'wp' action hasn't fired at that time.