Disable Jetpack Promotions and Notices in WP Admin

Cleanshot 2023 04 04 At 14.37.21@2x

In this code, we create a new PHP class called DisableJetpackPromotions. In the constructor function of this class, we add several WordPress filters that disable Jetpack promotions and announcement notices.

The jetpack_just_in_time_msgs filter disables all Just-in-Time messages that Jetpack might display in the WordPress dashboard. (I think that should catch them all, but if not…) The jetpack_just_in_time_msgs_allowed and jetpack_just_in_time_msgs_allowed_list filters prevent Jetpack from showing any allowed messages or messages in a specific list. Finally, the jetpack_just_in_time_highlight_reel filter disables the Jetpack Highlight Reel feature.

We’re also adding the basic promotion blocker using the jetpack_show_promotions and blocking Jetpack’s analytics data collection using jetpack_blaze_enabled.

We then create a new instance of the DisableJetpackPromotions class to ensure that these filters are applied when the WordPress site is loaded. The Snippet is set to run only in the WP admin backend. But in the event you don’t use it inside of Code Snippets Pro ❤️, it also checks for is_admin so that it’s only running when necessary.

👆 This shortcode was added to the Post using Block Editor

👇 This Shortcode was added to the Single Template using FSE

Use the JSON file for easily importing into your CodeSnippetsPro plugin. Use the PHP file or just copy/paste the code sample into your functions.php if you’re not using CodeSnippetsPro.

Related Snips

Leave a Reply

Your email address will not be published. Required fields are marked *