This is a work in progress, so bear with me as it is not done yet!
Jetpack, created and maintained by Autommatic, has increasingly moved toward monetization over the past years. As part of this process, Autommatic wants to generate more and more revenue. There was a time in the not too distant past when the leadership at Autommatic felt that charging for plugins was the wrong thing to do. Gone are those days.
I am increasingly finding negative articles on the Internet these days about Jetpack. Most focus on what should seem to be common sense when it comes to building not only a WordPress website – but any kind of website: the more bloated with additional code we make a website – the slower and less efficient it will become. That really should be the first rule of programming (or any kind of website development).
My experience has been that we are fine without Jetpack. There are numerous other free plugins out there that perform the same or better for the various additional functionality the Jetpack claims.
Fortunately, stopping this nag doesn’t appear to be as simple as adding what’s called a “filter” to your child theme’s functions.php file. Filters are functions that are “hooked” to an event in WordPress (that are called “hooks”). When specific events are triggered during code execution, filters can be created to compared against them. When a match occurs, the filter is applied to the data output generated by the event hook. The desired outcome is to prevent the undesired output.
It is important to remember that filters perform their actions on the data they receive and then return that data before it is displayed in the browser.
In some experiments, below is an example of what I added to the functions.php file of one of my sites to stop the Jetpack nag. I have, hopefully, included ample remarks, so the next programmer stumbling through my code knows what was done, where it was done, and why. Please feel free to email me with any ideas on how to make this actually work:
/* -- Start of Jetpack nag removal filter --*/ add_filter( 'jetpack_just_in_time_msgs', '_return_false' ); /* -- End of Jetpack nag removal filter --*/
Here is the code that was printing the Jetpack nag in the admin’s dashboard:
<div class="notice wcs-nux__notice "> <div class="wcs-nux__notice-logo "> <img class="wcs-nux__notice-logo-jetpack" src="https://charlesworks.com/wp-content/plugins/woocommerce-services/images/jetpack-logo.png" > <img class="wcs-nux__notice-logo-graphic" src="https://charlesworks.com/wp-content/plugins/woocommerce-services/images/wcs-notice.png"> </div> <div class="wcs-nux__notice-content"> <h1 class="wcs-nux__notice-content-title"> Connect Jetpack to activate WooCommerce Shipping & Tax</h1> <p class="wcs-nux__notice-content-text"> WooCommerce Shipping & Tax is almost ready to go! Once you connect Jetpack you'll have access to automated tax calculation, shipping label printing, and smoother payment setup.</p> <p class="wcs-nux__notice-content-tos"> By clicking "Install Jetpack and connect", you agree to the <a href="https://wordpress.com/tos/">Terms of Service</a> and to <a href="https://jetpack.com/support/what-data-does-jetpack-sync/">share certain data and settings</a> with WordPress.com and/or third parties.</p> <button class="woocommerce-services__connect-jetpack wcs-nux__notice-content-button button button-primary" > Install Jetpack and connect</button> </div> </div> Hiding using CSS div.notice wcs-nux__notice { display:none; } or <div id="notice wcs-nux__notice">Some Content</div> You may need to wrap CSS styles in between <style type="text/css"></style> tags, example: <style type="text/css"> div#notice wcs-nux__notice { display:none; } </style> div.notice wcs-nux__notice { overflow: hidden; visibility: hidden; height: 0; width: 0; }