Support » Fixing WordPress » Can't figure out excluding categories on RSS

  • bigvibes

    (@bigvibes)


    I’ve looked through the forum and found this code, which I input into my functions.php file to try to exclude a few categories from RSS. It’s not working though. Could there be a conflict between WordPress RSS feed and Feedburner? I run both and the Feedburner feed does exclude the categories because I’ve gone into their system and excluded them. But the original feed still shows everything. I can’t figure it out. Any ideas? thanks

    I’m running a child theme and this is the complete content of that file:

    <?php

    function myFilter($query) {
    if ($query->is_feed) {
    $query->set(‘cat’,’-317, -1, -487, -691′);
    }

    return $query;
    }

    add_filter(‘pre_get_posts’,’myFilter’);

    ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Frumph

    (@frumph)

    Try this, instead of your current if area:

    if ($query->is_feed && !is_category()) {
    		$query->set('category__not_in',array(317,1,487,691));
    
    	}

    Inside your code.

    bigvibes

    (@bigvibes)

    Uh uh. That totally took down my website….

    Frumph

    (@frumph)

    FTP in and fix it.

    bigvibes

    (@bigvibes)

    I did go in and fix the site so it’s working again, but the feed issue is still there.

    Frumph

    (@frumph)

    .. did you update a post after adding that code to the functions.php ?

    The feed is cached until a post updates.

    My apologies, it turns out the original code was working for me. Some posts were just really delayed for some reason.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can't figure out excluding categories on RSS’ is closed to new replies.