• I saw this post: http://wordpress.org/support/topic/wp-31-breaks-rss-customization-via-exclude_category?replies=14
    and tried implementing the listed code to hide categories:

    blockquote
    function exclude_category($query) {
    if ( $query->is_feed && $query->query_vars[‘all’] != ‘true’ ) {
    $query->set(‘category__not_in’, array(473,281));
    }
    return $query;
    }
    add_filter(‘pre_get_posts’, ‘exclude_category’);
    blockquote

    but it didn’t work. The code showed up on my homepage… I’m using a child theme and the functions.php file for that theme is empty. Could that be the case or is that code incorrect? Or should I put the code in the main theme’s file? If so, where? Then I guess I would have to redo it every time I update.
    thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Add this custom function to the child theme’s function.php file making sure it is done right.

    The structure of functions.php is simple: An opening PHP tag at the top, a closing PHP tag at the bottom, and, between them, your bits of PHP. In it you can put as many or as few functions as you wish. The example below shows an elementary functions.php file that does one simple thing: Adds a favicon link to the head element of HTML pages.

    http://codex.wordpress.org/Child_Themes#Using_functions.php

    Thread Starter bigvibes

    (@bigvibes)

    Thanks for that. I think that’s what I did. But maybe the code is not correct?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘hide categories from rss feed’ is closed to new replies.