Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to remove the action hooks added by SEO ultimate plugin for some pages. The way it is added in the plugin's class is

    //Hook to output all <head> code i changed the priority to 2
    add_action('wp_head', array(&$this, 'template_head'), 2);

The SEO plugin creates a global variable like this

global $seo_ultimate;
    $seo_ultimate =& new SEO_Ultimate(__FILE__);

In my plugin, i try removing it by

add_action('wp_head',array($this, 'remove_seo_header'),1);

    }
    function remove_seo_header() {

         remove_action('wp_head', array($seo_ultimate,'template_head'));
}

But it does not remove the action. Can anyone point out where am I wrong?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You have to use the same priority, and you need access to the global variable:

function remove_seo_header() {

    remove_action(
        'wp_head', 
        array( $GLOBALS['seo_ultimate'], 'template_head' ), 2 
    );
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.