post__not_in function is for exclude categoryes. Try with:
$query = new WP_Query( 'post__not_in' => array( 2, 5, 12, 14, 20 ) );
maybe your problem is in syntax
Related Posts:
- Can an array be used as a meta_query value?
- How do I dynamically generate args for wp_query?
- How to use $query->set with post__in?
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- extract serialized array to use for wp-query
- How can I split my query result in 2 arrays?
- array_rand not working correctly?
- Order a WP_Query by meta value where the value is an array
- Using multiple variables to assign categories to an array
- Sending simple variable on single page to WP JSON
- in_array not working on dev server but works on localhost
- Combine multiple queries, array_unique returns nothing
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Best Practice for PHP
- How to create a WP_Query to search the Title or Tag?
- how to display active, upcoming and past event with featured listing with pagination
- Get list of WP Updates Across Sites
- Need to get specific data from array
- if statement on database query
- WP_Query sort using multiple numeric meta values
- How to get to a specific position in wp_query?
- API response to be stored locally
- How to convert objects into arrays
- WP_Query loop, does not display special characters in title correctly
- Remove query string specific key value
- Admin Options page. Save as Array
- How to filter posts by post format “standard” from wp-json api?
- how can i show only the parents in owl-carousel?
- Using foreach loop breaks
- Get users that likes the post
- auto-populating custom nav with all items from custom post type
- WordPress theme options error
- Get posts from multiple post type
- WP_Query fails despite having 1 post
- Create a Blog Template Page
- Exclude posts with specific metadata from search?
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to use if statement in an array? [closed]
- Display an image if odd number of posts in grid
- How do I turn these values from MYSQL into an array
- How do I create a numbered list with PHP? [closed]
- Get categories names as an array to use it in theme settings
- Why doesn’t PhotoSmash plugin play well with wp_query?
- Warning: in_array() null given in PHP function
- WP_Query: getting posts where custom field exists
- Foreach loop inside an array_merge
- How to show meta value code HTML after x paragraph
- Form search query – displaying ACF “Post Object” field as results
- get_the_ID() doesnt work
- Custom route and query
- change the default order of posts only for specific categories
- how to make an array of post id’s in is_single
- WP_Query() load selected post
- How to get post category list as select in front-end?
- Dynamically adding filters
- How do I check if there is a tag in the title
- Search.php gets metadata from first post
- the_post(); prints out style text into my HTML?
- Repeat a function with 24hrs gap for n number of days
- WP_Query for woocommerce products with a pattern as a post_title
- WordPress Search Ajax + Isotope + InfiniteScroll
- How do I make these combination select filters work when only one dropdown is set? They work in WordPress 5.8.2 but don’t in 5.8.3
- Order users by random not working?
- How to call my PHP function with AJAX ? wp_query
- Ajax filter with loadmore button
- Display featured image of post type category
- Delete post meta by serialized meta value
- can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?
- WP post meta – for loop inside for loop
- WP_Query To Display Product Of Brand On Taxonomy Page
- Store custom field’s multiple values in one user meta key
- How to display last whole post on the homepage
- Trouble with checked() for array of multiple checkboxes
- wp_query beginner
- How to use foreach and if statement within array of arrays?
- For each 3 posts, show a different post type
- WooCommerce – Print Processing orders [closed]
- WP_Post is not from correct array
- List of child pages fetch next results at link click
- Query category-specific, paginated posts and allow viewer to change sort order
- Adapting a php array to WordPress
- allow previews outside wordpress folder (Outsourcing WP previews)
- How to get category pages to look like a certain archive page?
- Post Title Not showing up
- Advanced Taxonomy query, with 3 post types
- reorder a WP_Query, using a dropdown
- Custom query_posts() parameter
- What is this mark for “? function()” [closed]
- How to combine array info [closed]
- How to modify this function to exclude also the post belonging to a specific category?
- Display biography post for today’s birthday person
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- save array of objects with update_option
- How do I run the following script from my articles page?
- Execute multiple PHP Snippets causes error?
- Three different queries on same page
- How to sort search result by post_title, then by post_content
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress