If you are trying to omit posts 1,3,5 from category 3 on your blog, you can use the following code
$query = new WP_Query( array('cat' => 3, 'post_type' => 'post', 'post__not_in' => array(1,3,5) ) );
The query results will not show posts with ids 1,3,5 of category 3.
Related Posts:
- Querying posts from current category, using a variable as array argument
- Sort Posts Alphabetically Based on Specific Category (Divi)
- How to show related posts by category
- Display all posts from specific categories on a page
- Query posts from current year
- Query only Posts from Both of Two Category?
- Order post by year DESC and month ASC
- Featured Posts for Category Pages
- Exclude posts with empty post_content in wp_query
- Improving WP_Query for performance when random posts are ordered
- Category Foreach keeps looping?
- WordPress custom Query for Posts in Category display posts multiple times
- How can I setup a relationship using categories in WordPress?
- posts_per_page option limits the number of Gallery items
- How to make multiple sections in home pulling posts category wise?
- Counter is skipping post when I still want it visible [closed]
- Query for first 3 posts to change the look and feel
- How to give classname to post if post has no content?
- All categories displays the same posts
- WordPress displays post on subcategory only
- How to get posts ordered by using their categories?
- How to display only one category in a custom post type?
- Getting posts from some categories plus some individual posts
- Get current taxonomy and display query accordingly
- How to fetch courses in all languages in WordPress?
- How to display particular categorie’s post which associated to specific user?
- Show 5 posts and than 3 posts offset with pagination
- AJAX load more posts not using correct category and repeating the same few posts
- How to run select query of post with category and tags?
- Query posts from newest category
- Sort Events by Venue Title – Sort Post set by related post ids
- Need help writing loop to display posts by categories in separate divs
- Sort / Filter Queries
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- How to pass multiple checkbox values to wordpress query?
- Sort post by category using HTML Select tag
- Creating pages and getting their values from the database table
- How to limit post query to only return a total count of items with certain post statuses?
- Change from all posts to specific categories post on main page?
- How to show related posts by detecting the current category?
- Display posts on a custom page from only a specific category?
- How to show all posts of the category in wordpress?
- Different post sort order within different categories
- How to get Category Id from Post Id ?
- Number of posts per page setting is not working?
- Exclude category on blog list page
- How to choose a sort order (for posts) per category? (ideally when creating a new category)
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- wp_enqueue_media() slows down my WP site
- Query posts from different categories in multisite
- Display posts in alphabetical order for a particular category
- How to make search for the custom post type?
- Direct link to “New post” in specific category?
- How To Get Posts With A Specific Word
- do_shortcode within post query
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Using permalinks, category slugs, and tag slugs
- Get attachments for posts that belongs to a specific category
- Get all comments of author’s posts
- How show categories in admin and get that selected to show posts in index
- Do not show children of a category
- singular posts using archive styling
- Display selected categories onto post page
- Some doubts about how the loop work (trying debugging it)
- Change the background of each post according to the category
- How to show category based post in home page?
- How to view all posts (on site, not admin) that are uncategorized?
- How to create a list of links to post with specific category
- query for filtering published posts?
- Trying to exclude custom posts based on date, while sorting by custom field
- Pull in posts using post meta for REST API
- Post meta not working
- get category in list of posts // shortcode for custom related posts
- How to search through “post title” and “tags” using WP_Query?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- How to add a ‘News’ section to specific posts in WordPress
- Get Category in save_post Hook
- I have two post types in the same query, how can I use CSS to select only one post type?
- How to show category image if no featured image is set?
- WP_Query to get posts in a specific tag or has post_format
- Make recent post display recent updated, instead of recent published
- Numbering author posts in posts query
- Static text above category page
- get_page_by_title() not working if special characters are present
- Show only top 3 posts from 3 categories in order on home page
- Continuous listing from a custom field
- 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
- Display ONLY Latest Post From Several Categories
- 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
- Why does ‘get_the_ID’ work outside of the loop?
- How to specify a post category for the home (posts) page?