Post count: 8334
Hi EgorRevenga,
You can try to use this code below and put them on the functions.php
file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
add_filter('the_content', function($content) { global $post; $flag_post = false; // include category ids $include_catgory = array(123, 321); $categories = get_the_category( $post->ID ); foreach ( $categories as $category ) { if ( in_array($category->ID, $include_catgory) ) { $flag_post = true; } } if ( ! $flag_post ) { remove_filter('the_content', array(JNews\Ads::getInstance(), 'inject_ads')); } return $content; }, 9); |
Thank you