Exclude Category from Feed


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Custom Feed Query
  2. function customFeedquery($query) {
  3. if(is_feed()) {
  4. $query->set('cat','-8'); // exclude category 8
  5. return $query;
  6. }
  7. }
  8. add_filter('pre_get_posts', 'customFeedquery');

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.