0

Im trying to use

remove_action( 'admin_notices', 'woothemes_updater_notice' );

In a plugin to keep from editing the themes functions.php file however the code isnt being executed. Do i need to wrap this in something to get it to work from the plugin files?

2

Make sure you remove the action after the theme has added it. And use the same priority.

A rather safe way is using the same action you want to clean up:

add_action( 'admin_notices', 'remove_woothemes_updater_notice', 0 );

function remove_woothemes_updater_notice()
{
    remove_action( 'admin_notices', 'woothemes_updater_notice' );
}
  • Your way isn't working, sorry. – Noob Theory Aug 29 '13 at 1:59
1

Found the answer just after posting. If anyone is having the same issue i solved it with this.

// Remove WooCommerce updater plugin notice
function woothemes_updater_notice() {
    remove_action( 'admin_notices', 'woothemes_updater_notice' );}
add_action( 'admin_head', 'woothemes_updater_notice' );
  • I find it funny that you need to add and action in order remove another one. – Mario Aug 29 '13 at 0:21
  • Only way i could get it to work. – Noob Theory Aug 29 '13 at 1:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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