Exclude categories - wordpress

by Toon-c
3 replies
Hi ..

I have a multi authors blog, and I want to forbid publication of articles in some specific categories ..

how can I do that ??

will be thankful !
#categories #exclude #wordpress
  • Profile picture of the author Mr.YeaBuddy
    if your going to continuously get new authors just make up a how to guide with screen captures and arrows drawn on it pointing to stuff explaining it. Its the easiest way to get your authors on track. As for editing that, you will need to find that in the wp file for the editor.
    {{ DiscussionBoard.errors[3058832].message }}
  • Profile picture of the author Mr.YeaBuddy
    I actually meant for this reply to be in another thread though it could be helpful for you too heh.
    {{ DiscussionBoard.errors[3058837].message }}
  • Profile picture of the author deepakg
    Add the following lines to your WordPress Theme's template functions.php file (For example, functions.php file for a Theme named "default" would probably reside in the directory wp-content/themes/default/functions.php) or create it as a Plugin by filling the additional Standard Plugin Information:

    Code:
    <?php
    function exclude_category() {
    	if ( is_feed() ) {
    		set_query_var('cat', '-5');
    	}
    }
    
    add_filter('pre_get_posts', 'exclude_category');
    ?>
    The code example above is for excluding category ID 5 from feed.
    {{ DiscussionBoard.errors[3061398].message }}

Trending Topics