Last Updated on April 20, 2020
Who is your core target audience? Your feed subscribers? Your search engine visitors? Both categories? If both of them are your target, it may occur that you don’t want them to see everything you write. Taking into consideration the explosion of paid review companies, bloggers are tempted to write posts for money, posts which are not always on the topic of their blog.If you are in this situation and you fear your feed readers may be offended by your paid reviews, you can choose not to show them these posts.
All you need to do is add several code lines to the functions.php file in your theme:
function myFilter($query) {
if ($query->is_feed) {
$query->set('cat','-5');
}
return $query;
}
add_filter('pre_get_posts','myFilter');
In the above code, you need to replace category number with the correspondent on your blog (for this purpose, you’ll need to define a category for all paid reviews you are going to write).
Source of inspiration: Zeo
very nice tip…
although i only did my first paid post, i was worried about this issue…
I thought of you when I wrote this post, Pearl 😉
It is better not to make people unsubscribe because of the sponsored reviews.
I am going to work on it this weekend … thank you so soo much 🙂
Great tips site! I am curious whether the code could still be working or not.