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.

In wp-signup.php there are these lines:

add_action( 'wp_head', 'wpmu_signup_stylesheet' );
get_header();

I need to remove wpmu_signup_stylesheet from the wp_head action, but I seem to be struggling, I assume it is because the action is being called straight after.

Here is what I've tried from a plugin:

// Called from an action that is added with:
// add_action('wp_head', array($this, 'remove_signup_style', 11));
remove_action( 'wp_head', 'wpmu_signup_stylesheet');
share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

The action is not right after actually. There is get_header() call, then get_header action and then locating and loading template file that has wp_head() in it.

I try not to mess with removing things from inside of same hook you are at, so in this case I'd (ab)use that get_header action to hook function that will remove what you don't want from later wp_head.

share|improve this answer
    
Many thanks, just changed the hook of the function that called remove_action to get_header. –  Dunhamzzz Jul 22 '11 at 13:49
add comment

Thanks for the tip @Rarst! Working code below.

//Remove the css injected into wp_head for the wp-signup.php form
add_action('get_header', 'remove_wpmu_signup_styles');
function remove_wpmu_signup_styles () {
    remove_action('wp_head', 'wpmu_signup_stylesheet');
}
share|improve this answer
add comment

Try adding a priority:

remove_action( 'wp_head', 'wpmu_signup_stylesheet', 11 );

p.s. is the add_action() call really placed before get_header(), or is it placed before wp_head()? I'm not sure it really matters, so long as wp_head() is included in header.php; but that's just an unusual place to add an add_action() call.

share|improve this answer
    
The priority arg passed to remove_action() has to match the one from add_action(). –  scribu Jul 22 '11 at 13:41
    
I always seem to forget that! :) –  Chip Bennett Jul 22 '11 at 13:43
    
Yeah those two lines are exactly as that in wp-signup.php. As per the docs you can only remove an action if the priorty is the same, the weird thing is that remove_Action actually returns true yet the action is still being ran. –  Dunhamzzz Jul 22 '11 at 13:47
add comment

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.