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.

HI there,

I want to remove the actions added to wp_head by a plugin but only in certain circumstances.

Here is code that doesn't work:

if (is_single() && get_post_type()  == 'tenant') {
  $row = $wpdb->get_row("SELECT * FROM Events WHERE WP_ID='$post->ID'",ARRAY_A);
  remove_action('wp-head',array($aiosp, 'wp_head'));
  $seo_head = "<title>" . $row['Event'] . " | " . $row['Town'] . 
              " | Events in ". $row['Country'] . "</title>";
}
share|improve this question
1  
Are you sure $aiosp isn't null? –  scribu Feb 10 '11 at 16:32
2  
You need to give more information so we can help you. It would be useful to know the context in which you are running the code you say that doesn't work and what you'd expect it to do if it were working per your wishes. –  MikeSchinkel Feb 10 '11 at 16:33

2 Answers 2

My guess is that it's not working because the action name is 'wp_head', not 'wp-head'.

remove_action('wp_head',array($aiosp, 'wp_head'));
share|improve this answer
up vote 0 down vote accepted

Sorted it, turns out all-in-one-seo-pack can be disabled on a post by post basis, so I used: add_post_meta($post->ID,'_aioseop_disable',true); inside the if parameter and before setting my own title, works a charm.

PS $post is gotten with global $post;

share|improve this answer
    
Please mark this as "the" answer so that future readers know what to do to fix the same problem. –  EAMann Feb 10 '11 at 19:16

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.