Most of the things you can do with a query are described in the Codex page for WP_Query
You need to use the ‘post__not_in’ parameter eg:
$args = array(
'post__not_in' => array('34','54'), // post ids
'post_type' => 'page'
);`
Related Posts:
- Make recent post display recent updated, instead of recent published
- Manipulate query to show specific post
- update a posts of other custom post type
- Querying posts from current category, using a variable as array argument
- Pull new posts using feed
- How to correctly escape data
- Use special template for the first post in the loop
- Blog posts not displaying on blog posts page
- wp_remote_post and form post
- Ordering Posts By Meta Data
- Repeating post how to solve this
- Filter posts by current date ( WP Post Carousel )
- Sort Events by Venue Title – Sort Post set by related post ids
- How to set class to “current-page” on the currently viewed single post within a CPT
- Need help writing loop to display posts by categories in separate divs
- How to display most popular post by views count in WordPress?
- No duplicate tags by category
- Get posts by category or author
- Sort / Filter Queries
- get_page_by_title() not working if special characters are present
- Modify WordPress loop after it has been run
- Query post category & remove any post id
- show latest authors blog post
- How to get Last post Id of custom post type in wordpress
- Order posts by ACF checkbox
- query_posts() with multiple meta data comparisons
- get “read more” with custom DB query like you would with WP Query
- How to get only current images of a post
- Ordering posts alphabetically by meta keys and title
- Sort Posts By Custom Field Date
- 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?
- Custom query posts error
- Automatically create a loop for post ID
- How do I control the fallback query after the original query returned cero posts?
- query_post causes the posts to be loaded twice on load more posts
- Remove duplicated posts in the loop if post has more than one category
- How to pass multiple checkbox values to wordpress query?
- Post per page not working
- Show previous month’s posts
- get post excerpt by query
- Adding a category at even positions on main loop with modified pagination
- why is pre_get_posts not working
- Query Posts From Multiple Post Types
- wp_query by last month + sort posts
- How to limit the number of results for all query_posts on mysite
- query_posts result differs from wp_query request result
- query_posts not working after wordpress 3.7 update
- If meta_key has value = 6 | Change the wp_posts.post_date to current date
- Post Filter clearing on pagination $_post
- get_next_posts_link() stops displaying at page 4
- How to get all post titles starting with numbers and symbols?
- How to inject a post within a loop
- WP Build-In Post selector for CPT
- How to get alphabetic listing x other posts, based on first letter post?
- Multiple post queries -category,posts per page,orderby
- Query posts based on parents attribute
- wp_query select if have comments
- Is that the query_posts() the real criminal here?
- Creating pages and getting their values from the database table
- Adding Category Argument into an Array for WordPress Query
- single.php fires more than once after clicking on any post to view with different post id each time
- How to optimize ‘select found_rows()’ query? Several ‘high load average’ alerts daily
- How to limit post query to only return a total count of items with certain post statuses?
- How to can I search range of products using between
- query multiple posts by id using a string parameter, not array()
- orderby not working for query_posts using array of IDs
- Query specific posts from parent by slug rather ID
- How to limit the number of posts on the home page?
- Collect posts from last 48 hours
- query_posts – slightly more advanced query
- Query posts in a category and include only one post per author?
- query_posts and sub pages?
- How to refine WP-Query with further criteria
- Query Posts Creates 404 Error
- Not displaying any articles on a custom made file
- The_content display a different content from a previous loop
- How to go to tag archives using a form
- Run second query on page based on author of the first query
- WordPress loop problem: Multiple loops, index.php and is_paged causing duplicate posts on next page
- Query Posts (post meta)
- Why doesn’t this page query work?
- Including post data in a sidebar occurring outside of and before the Loop
- Multiple loops with / without sticky posts and different post limits
- get all posts with certain meta data
- wp trim function not working
- prevent display duplicate titles on main page
- Achieving pagination with `query_posts`
- query_posts works while get_posts doesn’t
- How to modify this function to exclude also the post belonging to a specific category?
- Resetting a Query using wp_reset_query() or wp_reset_postdata() does not work
- Sort posts with multiple meta_keys
- Lots of SQL queries
- Change from all posts to specific categories post on main page?
- How to get custom post type posts with certain multiple tags names and category id?
- Create “archives by year and week” by category template
- How do I find the first item in the post array?
- query_posts different amount of posts per page [duplicate]
- Limiting the amount of posts this displays
- Count words for all posts by all authors