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
Leave a Reply