Greetings,
I'm trying to filter NSFW posts from my main page, but this is not working:
query_posts("tag=-NSFW");
Can someone help me please?
Greetings,
I'm trying to filter NSFW posts from my main page, but this is not working:
query_posts("tag=-NSFW");
Can someone help me please?
No one? :(
I'm desperated about this and couldn't find it anyware.
I want to do a NSFW filter on my website, based on tags
Tags are just not as functional for these sort of things as are categories. Try making a NSFW category and using a conditional tag with the category ID (shown here with category ID 44):
in_category('44');
http://codex.wordpress.org/Conditional_Tags
http://codex.wordpress.org/Template_Tags/in_category
There is no conditional tag for in_tag().
Another option is to look for a plugin that lets you choose which posts to have on your main page.
Try with query_posts("tag__not_in=XX"); where XX is the tag ID you want to exclude.
iridiax:
I'm trying to avoid making a NSFW category. I just doesn't make sense.
As to the plugin, I've actually found one that does it. But it doesn't give me the option to be able to allow NSFW at the home if I set a cookie to do so.
xknown:
It doesn't work :(
xknown: I'm having this same problem with tag__not_in not working properly. I think it may be a bug. See here:
http://wordpress.org/support/topic/205818?replies=10
http://trac.wordpress.org/ticket/7798
Try inserting this before your loop:
//array of tags to exclude, by tag number
$exclude_tags = array(1,2,3);
global $wp_query;
$wp_query->set('tag__not_in',$exclude_tags);
$wp_query->get_posts();This topic has been closed to new replies.