How to control Jetpack Ad placements using Hooks

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.

jetpack-ads-settings.png

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

Hook: wordads_content_disable
Filters enabling ads in `the_content` filter

Example:
add_filter( 'wordads_content_disable', '__return_true' );


Disabling ads in the_excerpt

Hook: wordads_excerpt_disable
Filters enabling ads in `the_excerpt` filter

Example:
add_filter( 'wordads_excerpt_disable', '__return_true' );


Disabling ads placed within posts

Hook: wordads_inpost_disable
Allow third-party tools to disable the display of in post ads.

Example:
add_filter( 'wordads_inpost_disable', '__return_true' );


Disabling header ads

Hook: wordads_header_disable
Allow third-party tools to disable the display of header ads.

Example:
add_filter( 'wordads_header_disable', '__return_true' );

Comments

  1. Finally! What a great update! I waited for this and now I will enable WordAds again. Previously it was really bad because we always needed to contact you guys to make any changes. But now we can finally adjust it on our own.

    Thanks a lot for the improvement!

    1. You will see your February earnings at the end of March; payments are indeed always sent around the last day of the following month.

Comments are closed.