Created
September 17, 2015 20:46
-
-
Save webmasterninjay/7ce707fe80a4743d9504 to your computer and use it in GitHub Desktop.
This plugin remove the annoying Yoast SEO nag in your wordpress dashboard every update.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Remove Yoast SEO Nag | |
* Plugin URI: https://wordpress.org/ | |
* Description: This plugin remove the annoying Yoast SEO nag in your wordpress dashboard every update. | |
* Version: 1.0.0 | |
* Author: Jayson Antipuesto | |
* Author URI: https://wordpress.org/ | |
*/ | |
defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); | |
add_action( 'admin_init', 'remove_yoast_seo_nags' ); | |
function remove_yoast_seo_nags() { | |
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'wordpress-seo/wp-seo.php' ) ) { | |
add_action( 'admin_notices', 'remove_yoast_seo_nags_notice' ); | |
deactivate_plugins( plugin_basename( __FILE__ ) ); | |
if ( isset( $_GET['activate'] ) ) { | |
unset( $_GET['activate'] ); | |
} | |
} | |
else { | |
remove_action( 'admin_notices', array( Yoast_Notification_Center::get(), 'display_notifications' ) ); | |
remove_action( 'all_admin_notices', array( Yoast_Notification_Center::get(), 'display_notifications' ) ); | |
} | |
} | |
function remove_yoast_seo_nags_notice(){ | |
?><div class="error"><p>Sorry, but <strong><em>Remove Yoast SEO Nag Plugin</em></strong> requires the <strong><em>Yoast SEO plugin</em></strong> to be installed and active.</p></div><?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment