Created
October 16, 2019 18:29
-
-
Save ginsterbusch/47d647f63cce47479776409d41dbfaf5 to your computer and use it in GitHub Desktop.
Quick enhancement of the micro plugin to "Remove WooCommerce Nag" :)
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 WooCommerce Nag | |
* Plugin URI: https://devanswers.co/remove-woocommerce-nag/ | |
* Description: Gets rid of nag: "Connect your store to WooCommerce.com to receive extensions updates and support.". Enhanced by <a href="https://usability-idealist.net">Fabian Wolf</a>. | |
* Version: 1.1 | |
* Author: DevAnswers | |
* Author URI: https://devanswers.co/ | |
*/ | |
if ( !class_exists( 'RemoveWooCommerceNag') ) : | |
class RemoveWooCommerceNag { | |
public static function init() { | |
new self(); | |
} | |
public function __construct() { | |
add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) ); | |
} | |
public function plugins_loaded() { | |
if ( is_admin() ) { | |
if( function_exists( '__return_true' ) ) { | |
add_filter( 'woocommerce_helper_suppress_admin_notices', '__return_true' ); | |
} else { | |
add_filter( 'woocommerce_helper_suppress_admin_notices', array( __CLASS__, '__return_true' ) ); | |
} | |
} | |
} | |
public static function __return_true() { | |
return true; | |
} | |
} | |
RemoveWooCommerceNag::init(); | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment