apply_filters ( 'wordads_inpost_disable', bool true )

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

Source file: modules/wordads/class-wordads.php

View in GitHub

Parameters

true

(bool) true Should the in post unit be disabled. Default to false.


Changelog

Since: Jetpack 4.5.0


Notes

You can use this filter to disable Ads appearing below the post content in specific situations.

In the example below, we’ll disable all Post ads:

/**
 * Disable Ads appearing below the post content.
 */
add_filter( 'wordads_inpost_disable', '__return_true' );

 

This example disables all post ads for a specific post:

/**
 * Disable Ads appearing below the post content in a specific post.
 */
add_filter( 'wordads_inpost_disable', 'htdat_disable_one_post' );

function htdat_disable_one_post( $bool ) {  
  // Replace 123 with your own value
  // See allowed values in https://developer.wordpress.org/reference/functions/is_single/
  return is_single( 123 ) ? true : $bool; 
}

Have a note to contribute?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Comments

  1. Manni de Man says:

    Not working, please provide exact description and implementation advise. Also please let me know why there’s a different syntax here compared to github

  2. angelonfire says:

    Thank you this worked for me after I enabled the ads on accident. Added it to my functions.php and bingo!

    • Jeremy says:

      I’m glad to hear it helped! Were you not able to deactivate the feature altogether, if you don’t want to display ads at all on your site?

      If you experienced issues when trying to deactivate the feature, you can contact us through this form and we will help you sort this out!

      • angelonfire says:

        Yes even when I tried to disable it it would still show the ads. It’s ok though the code worked it out. If I decide to add them I’ll def contact you.

  3. woofjaw23 says:

    How can I disable for a specific post, not all?

  4. brightfutureedu28846076 says:

    How can i stop ads from showing on my related post thumbnail?I only want the ads to be showing on my post button not on my related post thumbnail