Looking to customize where ads are placed on your site?
WordPress.com and Jetpack Ads users have site-level access to toggle where ads are displayed below posts and at the top of each page. You can also obtain more granular control of your ad placements using widgets.
In some cases, we’ve found users seeking additional control to specify whether ads display on specific pages or sections, so we’ve added a few hooks to Jetpack Ads to make that possible.
Currently, there are 4 filter hooks that will allow you to disable ads based on your choosing. These can also be nested within conditional statements – for example, if you wanted to disable body content ads in a certain category only.
Each of the code examples below can be safely pasted into your theme’s
functions.php file, or you can use the examples as a guide to implement the hooks in your own custom plugin or other setup.
Disabling ads in the_content
wordads_content_disableFilters enabling ads in `the_content` filter
add_filter( 'wordads_content_disable', '__return_true' );
Disabling ads in the_excerpt
Filters enabling ads in `the_excerpt` filter
add_filter( 'wordads_excerpt_disable', '__return_true' );
Disabling ads placed within posts
Allow third-party tools to disable the display of in post ads.
add_filter( 'wordads_inpost_disable', '__return_true' );
Disabling header ads
Allow third-party tools to disable the display of header ads.
add_filter( 'wordads_header_disable', '__return_true' );