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 show related posts by detecting the current category?
- Different post sort order within different categories
- Count how many posts in category
- Custom Single Post By Category
- Skipping first 3 posts in wp query
- How to add metabox for post of specific category
- How to get Category Id from Post Id ?
- Exclude category on blog list page
- Show One Category on Post
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- WordPress Child Category Display All Posts
- Add Category name to Post Title (h1)
- Display posts in alphabetical order for a particular category
- How to make search for the custom post type?
- How to automatically apply a category based on the post title?
- Direct link to “New post” in specific category?
- Display post category in foreach loop with category link
- Using permalinks, category slugs, and tag slugs
- How do I retrieve then print the currently viewed sub categories?
- Include sticky posts on the static page front page
- How can I setup a relationship using categories in WordPress?
- Set Default Category to Username
- Display post category in foreach loop
- Single.php – Get Current Parent Category
- get_the_category listing in hierarchial order
- How show categories in admin and get that selected to show posts in index
- How to get post content from an array of ids?
- Number of displayed posts
- if in category but only with post meta
- How to give classname to post if post has no content?
- singular posts using archive styling
- Display selected categories onto post page
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Show posts on front page only
- Post is in descendant category not working in home.php
- How to get posts ordered by using their categories?
- Hide parts of the post content after typing it’s name or searching it by category
- SQL Bulk Move old posts by one author to another category
- load more posts by category
- Display Related Posts by Category in Random
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- How to show beneath posts the full category path?
- Display Current Posts Category (with the most posts)?
- How to show multiple posts thumbnail, title and date in widget
- Only the most recent post is showing on my category page (working on localhost, not live site)
- Show only posts with titles/permalinks that do not contain certain words
- Display default matabox of posts(add category) wordpress
- ACF date picker to trigger category change
- Get category slug of the Parent category of a Product
- How to get tags when using publish_post
- exclude particular category in api
- How do you change the permalink for posts for a single category?
- Make categories appear random
- How to make a page show posts only from specific categories without editing php files
- Get posts from category from custom query
- How to show posts ordered by random [duplicate]
- Display new posts categories in separated divs
- Querying posts from current category, using a variable as array argument
- Add Categories To Custom Post
- Query posts from newest category
- Precedence of page permalinks over woocommerce product category links?
- Display Posts by Categories
- Ajax – Post Categories and Load More
- Edit Posts Page but not category specific pages?
- Add category selection to function request
- How to organise post by category and date
- Show post if in category
- How to display custom content in post with category XXX
- Displaying categories items among posts
- Displaying different posts Via wp_list_categories()
- Category pages vs single post pages
- Display ONLY Latest Post From Several Categories
- How do we display a certain category type on a page while hiding all others?
- Show all posts in category
- Polylang – display one post into 3 categories with different lang [closed]
- Export Posts Without Categories In An XML File
- Site ‘Categories’: save an admin global setting with post metadata [closed]
- Adding content to the top of post’s based on their category
- Display posts from a specific category on frontpage.php template?