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?
- Manipulate post category after time
- Categories box not showing on post edit pages
- Add custom field to all posts in specific category
- Can’t show comments count per post outside loop
- wp_list_categories link to first post of category instead of calling taxonomy template
- How can I get all posts data from within a paginated search result?
- How to Add ‘Post Categories’ to the Dashboard Sidebar
- How only display all post related to category
- Add category to all post by using sql query?
- Full Width Main Post
- WP_Query Authors OR Categories
- Why is querying posts messing up my pages?
- Pulling in post category and children within category
- Post categories to pages
- get query() without post content?
- WP_Query: Mixing category__in and tag__in together
- If in_category not working for multiple single.php pages
- Set Default Category to Username
- Display post category in foreach loop
- Single.php – Get Current Parent Category
- Get all custom post types excepted some…
- Get all comments of author’s posts
- if in category but only with post meta
- singular posts using archive styling
- WordPress post filter menu
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Programmatically add posts from specific category to menu
- Get post category as a separate string and url
- How to show category based post in home page?
- 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
- How to optimize posts query in wordpress
- Featured Story Shortcode not outputting content
- How to show post views shortcode data for each post on Posts List Page?
- 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
- Point users to a specific url directory for some posts
- Custom Select Query pagination not working properly
- get_page_by_title() not working if special characters are present
- Show only top 3 posts from 3 categories in order on home page
- Remove duplicated posts in the loop if post has more than one category
- 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
- How to store post rating system data post independent?
- Displaying different posts Via wp_list_categories()
- single.php fires more than once after clicking on any post to view with different post id each time
- Show all posts in category
- Polylang – display one post into 3 categories with different lang [closed]
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Site ‘Categories’: save an admin global setting with post metadata [closed]