Earlier this week, I wrote a rant post about WordPress plugins that make it difficult to suppress certain admin notices, about pages, and other nags (such as feature pointers).
After filing some pull requests, talking to a few developers, and poking around code on GitHub, I’ve been able to cobble together some solutions for a few popular plugins like WooCommerce and WordPress SEO.
WooCommerce by WooThemes provides a number of nags, mainly in the form of admin notices. It’s possible to remove them, but it’s not super intuitive.
In fact, I had previously suggested a fix (in the form of a pull request to WooCommerce on GitHub) that would have simplified this code. They quickly dismissed the request, so I dug into the code and found another way to do it (which I share below). I posted this code to the thread, and they quickly removed the snippet and locked the thread.
tl;dr: WooCommerce doesn’t want you to see this code. But I think it’s important, so I’m sharing it here.
Rather than filtering an option, you generally have to use WooCommerce’s built-in notice handling methods (via the WC_Admin_Notices class) to remove the notices. In the example, I also show how you can remove the “install the WooThemes Updater” nag, which is done in a more standard way by unhooking an action.
Here’s how the code looks:
I haven’t sussed out how to suppress the WooCommerce About screen, but if I sort it out I’ll be sure to post the code here.
WordPress SEO, the popular plugin from Yoast, has a few nag points — an About screen that displays for admins after upgrading or installing the plugin, and a feature pointer “tour”. Fortunately, it’s pretty darn easy to suppress these (though not immediately intuitive). You just have to filter the Yoast options array to trick it into thinking you’ve already seen the about screen and/or feature tour. Here’s the code:
Important note: Special thanks/props to Joost DeValk (Yoast himself) who took my pull request seriously and provided a great solution.
I’m going to make this a bit of a personal crusade. If you have a plugin you use that bugs you with notices or About screens, share it in the comments. If you have a method to stop it, share that too and I’ll add the code to this post.
Together, we can take back control of our admin area!