Skip to content

Instantly share code, notes, and snippets.

@ginsterbusch
Created October 16, 2019 18:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ginsterbusch/47d647f63cce47479776409d41dbfaf5 to your computer and use it in GitHub Desktop.
Save ginsterbusch/47d647f63cce47479776409d41dbfaf5 to your computer and use it in GitHub Desktop.
Quick enhancement of the micro plugin to "Remove WooCommerce Nag" :)
<?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