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?
- Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
- Display a mixed list of posts and media
- Migrate posts from category and sub-category via SQL
- Parent category / child category posts
- Posts Missing in Dashboard after update
- How to enable custom Shortcodes in Post Category Description? [duplicate]
- How to give classname to post if post has no content?
- Sort by last word in title
- Display post number by category
- singular posts using archive styling
- Custom Articles page only showing a limited number of posts per page
- Change Post Title For Specific Category
- Display selected categories onto post page
- How to call posts under a specific category on static front page?
- Related Posts function not working
- Give posts a particular template based on the assigned category
- How to have more than one page for your posts if you have 8 posts but can store max 4 on a page
- Extract wordpress posts content and category content
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- All categories displays the same posts
- Having pages after specifying post_type post
- Unable to differentiate between two categories under custom post type on single.php
- In what context should Categories and Tags be used
- Show posts on front page only
- list posts from two categories on a page – plugin not working
- get_posts not pulling the correct number of posts
- Use posts_where to exclude posts ids from wp_query
- Get x recent posts by author?
- Retrieving posts by their date and category
- Get latest post from categories
- How to create a playlist for audio associated with posts per category
- Are post, page and category IDs unique to each other?
- Change the background of each post according to the category
- Static pages not working
- Post-Archive like a page in a specific subdirectory
- Programmatically add posts from specific category to menu
- WP_Query of Category Not Showing First Post
- Post is in descendant category not working in home.php
- WordPress displays post on subcategory only
- How to get posts ordered by using their categories?
- Remove Featured Image from posts in specific category?
- How to show a featured image inside a post in only 1 single category
- If post does not exist, do something
- Hide parts of the post content after typing it’s name or searching it by category
- List latest posts with least comments in WP-Admin
- Internal linking to posts permalink fail because of spaces and stripe at postname
- SQL Bulk Move old posts by one author to another category
- How to display only one category in a custom post type?
- load more posts by category
- Get post category as a separate string and url
- Get only X number of categories
- Display Related Posts by Category in Random
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- How to make posts being uncategorized
- How to show category based post in home page?
- How to display a single(current) post from a category
- Sidebar limiting to 10 posts?
- Get posts from current category?
- posts going to 2 pages/categories only show up in 1
- displaying the categories post
- How to show beneath posts the full category path?
- What’s a theme that properly handles previews of different types of posts?
- Display Parent Category of a Post belonging only to Subcategory
- How to view all posts (on site, not admin) that are uncategorized?
- How to create a list of links to post with specific category
- Conditionally exclude post from specific category on home page sidebar?
- How to list post as buch of category, and all of them
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- How can I add a page that shows posts from a single category?
- Highlighting Current Category in the Archive and Feeds page
- Categories Listing and Highlighting current category item
- Get current taxonomy and display query accordingly
- Can I style single post that are in multiple catergories?
- Geting error in post and category [closed]
- Different post views for different category views
- Display most recent posts in category with Twenty Ten theme widget