RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

Remove Category From WordPress RSS Feed

I recently wanted to remove a specific category from my WordPress RSS feed. In my case, I wanted to create a short podcast that wasn't part of our normal podcast schedule, and I didn't want the program to find its way into iTunes and other podcast syndication sites.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

1
<?php 
2
/*
3
 Remove Category From WordPress RSS Feed
4
 http://www.beliefmedia.com/code/wp-snippets/remove-category-rss
5
*/
6
 
7
function beliefmedia_category_rss_filter($query) {
8
  if ($query->is_feed) {
9
   $query->set('cat','-3');
10
  }
11
 return $query;
12
}
13
add_filter('pre_get_posts', 'beliefmedia_category_rss_filter');

You will have to change the '-3' on line 3 to correspond to the category that you don't want to appear in your feed.

To determine the category that you want to eliminate, you will have to mouse over the category and note the ID number that will appear in footer of your browser.

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment