Please read this Codex page why you should not use query_posts()
.
If you really want to use query_posts()
:
query_posts(
'name' => 'test',
'category' => '-15' // notice "minus 15"
);
The right way to exclude category:
$query = new WP_Query(
array(
'name' => 'test',
'category__not_in' => array(15)
)
);
if ( $query->have_posts() ) {
.....
}
Related Posts:
- Get Posts Under Custom Taxonomy
- How to show related posts by category
- Query only Posts from Both of Two Category?
- is there a better way of combining this?
- Posts are not showing up on particular category
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Get mixed category random posts
- Get Posts Under Custom Taxonomy
- Get attachments for posts that belongs to a specific category
- Excluding posts not working
- Loop doesn’t exclude the specified category in home page
- How to create a “latest news” page showing a list of posts from blog category
- Exclude post category in a blog page
- How to add content above footer in posts from specific category
- Excluding category from post navigation in WordPress?
- How to Get Position of a Post from a category and tag
- Retrieve latest post by multiple categories with ID
- Exclude a ‘portfolio’ custom category?
- wordpress show category link instead of post link [closed]
- View post with specific category id and name which I selected in the backend (drop-down option)
- How to get the number of posts in a selected category?
- How to know if get_posts() failed?
- Show related posts by category but ignore one category
- Add custom field to category of custom post type
- Can I hide a specific post from latest posts page?
- How to show post(excerpt) from specific category on wp page?
- WordPress – Admin Manage Posts – Multiple Filters by Parent Category
- Custom Theme Want To Remove One Category From All Displays
- Divide Loop Into Days & Categories
- How Can i Get 5 Recent Post Title With Corresponding Link?
- Different template for posts of all subcategories of category
- Can I set and show “important” post in my blog?
- Mark menu item as current-menu-item for category
- How to set up multiple taxonomies for groups of posts
- How to display category from recent posts?
- how to get posts ids inside pre_get_posts filter?
- Can I divide the pages into categories?
- How do I restart my loop with get_next_post()?
- Duplicate posts and change category
- Category Foreach keeps looping?
- post categories
- display a random post thumbnail from a random category
- Post page to display specific category
- Exclude the first ‘n’ number of posts of a tag from home page?
- how to show single post in a custom template
- Limit the number of posts a category can have – newest post goes in, oldest one drops out, possible? plugin?
- How to Get Posts, Including Private Ones?
- Remove current category from post but display all others
- How do I show posts from another wordpress installation?
- How do I include the category next to the title of a post?
- How to show a custom taxonomy in the theme?
- How to import nested categories from XML file?
- How to exclude posts that already appear in the main loop, from the category loop
- Migrate posts from category and sub-category via SQL
- Posts Missing in Dashboard after update
- Display post number by category
- Custom Articles page only showing a limited number of posts per page
- Use posts_where to exclude posts ids from wp_query
- Get x recent posts by author?
- Remove Featured Image from posts in specific category?
- Sidebar limiting to 10 posts?
- How to list post as buch of category, and all of them
- How can I add a page that shows posts from a single category?
- Post in bulk based on category template
- Remove subcategory slug from url
- Can I show category name in url for only one of my categories?
- Automatic duplicate/copy of post to a related page in WordPress
- Post meta not working
- Is there a way to categorize a list posts all at once?
- Yoast breadcrumb URL shows category instead of the page
- On the online version of my blog posts disappear
- Current post categories and subcatecories outside of the loop
- Query prints posts without specific categories
- Foreach issue in get_posts function
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Re-order Category Meta-data
- Custom post styling per category?
- WP_Query to get posts in a specific tag or has post_format
- post categories – how to show only categories with a specific parent id
- Creating a “category” of featured posts
- How do I make it so that new posts within a certain category go into a certain page?
- List Authors For Current Category
- List posts of assigned categories in list of all categories on single.php
- Hide categories from showing above a Post
- Assign specific ads to specific categories/posts
- find posts with exactly 3/4 categories
- Use radio buttons & checkboxes for post categories
- Displaying only posts from a certain category on my custom page template
- WP_Query: Fetch posts that are in (category1 and not in category2), OR posts that are not in cagegory1
- Add default content to post (for specific category)
- Displaying posts on Homepage
- List posts that are in the same category as the current post title
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to get pagination working with “Pending” Posts
- Post’s arent displaying
- Show with echo if a post has two or more categories
- How can I get on the same row two post of different categories?
- append $_GET parameters to post
- hide particular category post from front page only [closed]
- Site ‘Categories’: save an admin global setting with post metadata [closed]