Skip to content

Instantly share code, notes, and snippets.

@wpchannel
Last active April 16, 2023 08:33
Show Gist options
  • Save wpchannel/7cdd6eed0927ea5732d7 to your computer and use it in GitHub Desktop.
Save wpchannel/7cdd6eed0927ea5732d7 to your computer and use it in GitHub Desktop.
Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices
<?php if (!defined('ABSPATH')) die('Restricted Area');
/*
* Plugin Name: Disable Yoast SEO Notifications
* Description: Hide annoying notifications after each upgrade of Yoast SEO plugin and others admin notices.
* Version: 1.1
* Author: Aurélien Denis
* Author URI: https://wpchannel.com/
*/
add_action('admin_init', 'wpc_disable_yoast_notifications');
function wpc_disable_yoast_notifications() {
if (is_plugin_active('wordpress-seo/wp-seo.php')) {
remove_action('admin_notices', array(Yoast_Notification_Center::get(), 'display_notifications'));
remove_action('all_admin_notices', array(Yoast_Notification_Center::get(), 'display_notifications'));
}
}
@wp-seopress
Copy link

❤️

@Beee4life
Copy link

Can it be the notice is now shown 'through' JS ?

I just noticed a pesky popup showing again after deleting a term (with the function @primathon shared in my functions).

@wpchannel
Copy link
Author

@Beee4life I don't know because I'm using SEOPress PRO for the vast majority of my websites now. No ads.

@Beee4life
Copy link

@wpchannel then why reply if you don't know or even use the plugin (anymore)

@emcniece
Copy link

emcniece commented Apr 16, 2023

Because they're the author of this gist, they get notifications for comments here, and they take responsibility for their work and want to help people that land here? Strange question.

If you mean to say "why reply if you can't answer my question" perhaps consider they did provide a solution, which is to use a different plugin.

@Beee4life
Copy link

We clearly have different opinions on what helpful replies are... because the question at hand is about a notice shown through js. Not whether I should use a different plugin or not... anyway, anyone who reads this, enjoy your day...

@wpchannel
Copy link
Author

@Beee4life I'm the author of this gist, and I'm always trying to answer to comments even after years like I do on hundreds of tutorials published on my blog. The original problem to solve was to hide annoying notifications from Yoast plugin: this gist did the job for years. But now, the answer that I give to people - not only you in my previous answer, is simple: you don't like ads, change your SEO plugin to another. I'm tired of updating my mu-plugins every 6 months just to hide an advert. That's my solution, maybe you prefer another one and if you take time to find the correct hook, I'll be happy to update my gist with your code. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment