Holy Messed Up Admin Filtering Batman!
-
Hiya WordPressers.
I need a little help. I have a fiction section on my website. I have it set up so I can write a fiction post and choose say “short stories” as the category and it will automatically be posted under short stories on the fiction page. That’s why I’m using posts instead of pages. With me so far? Ok… I want the fiction stuff to be completely separate from regular blog posts so I use this in my functions.php:
add_filter('pre_get_posts', 'exclude_category'); function exclude_category($query) { if ( $query->is_home || $query->is_archive || $query->is_search || $query->is_feed) { $query->set('cat', '-9'); } return $query; }to eliminate those posts from everything except the fiction page. The trouble with this is that the is_archive part stops me from being able to sort posts by category in admin. My question is — is there a way around this? I’ve tried everything I can think of.
Thanks for your time 🙂
The topic ‘Holy Messed Up Admin Filtering Batman!’ is closed to new replies.