Source file: modules/wordads/class-wordads.php
View in GitHubParameters
- 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; }
Not working, please provide exact description and implementation advise. Also please let me know why there’s a different syntax here compared to github
You can add the code snippet above to your theme’s functions.php file or to a functionality plugin, as explained here. That’s all you’ll need to do. If you experience issues, you can contact us through this contact form.
Thank you this worked for me after I enabled the ads on accident. Added it to my functions.php and bingo!
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!
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.
How can I disable for a specific post, not all?
You can use our (new) second example above.
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
Hi there,
WordAds shouldn’t be showing in your Related Posts section. If you’d like help with this please submit a support request at https://jetpack.com/contact-support.
Thanks!