I am trying to add a rel=next
and rel=prev
link tags to the head element of image.php
template file. I have Wordpress SEO installed and I like to hook to this plugin wpseo_head
action hook to achieve that.
What I would like to do is to check if the wpseo_head
action hook exists before I attach my action to it, and if not like in the case of the plugin is not installed or deactivated, I would use wp_head
instead.
I have tried has_action('wpseo_head')
function, but the problem with that is if there are no functions attached to this hook it will return false
even if the plugin is installed activated.
if (has_action('wpseo_head')) {
add_action('wpseo_head', 'ad_add_link_tag_image_head');
} else {
add_action('wp_head', 'ad_add_link_tag_image_head');
}
What is the way to check for actions that may not exist in Wordpress?
Thanks.