I’ve seen this happen when you have sticky posts. Try excluding them, like this:
<?php
$query = new WP_Query([
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 4,
'ignore_sticky_posts' => true,
]);
?>
Related Posts:
- How to get an array of post data from wp_query result?
- How to only display posts whose meta_value field is not empty?
- How to print the excuted sql right after its execution
- Find out total number of pages in global query on archive page?
- Resetting post data to previous loop in nested loops
- Is it possible to completely stop WP_Query retrieving posts?
- How to add taxonomy filter on the query fly?
- Pagination returns 404 after page 20
- Make a WP Query search match exactly the search term
- Make loop display posts by alphabetical order
- Displaying several specific pages using WP_Query()
- post_type is ignored by WP_Query when ‘tag’ argument is included
- How to query posts of standard post format. For real
- Orderby menu_order doesn’t work
- WP_Query by Category Name
- WP-CLI How to generate a list of posts with corresponding meta values
- Query to return maximum of one post per author
- Warning: urlencode() expects parameter 1 to be string, array given
- WP_Query OR clause for tax_query and keywords
- How to get the posts published in last two days using WP_Query?
- All sticky posts are returned in custom query
- Get attached media only
- query posts in functions.php and update a field
- get_posts() seemingly ignoring post_type
- If orderby parameter using pre_get_posts is the same for multiple posts what fallback does the query use?
- Can not switch the queried post in pre_get_posts hook
- Why use JSON API to display recent posts?
- Why query_vars get altered in WP_Query Object?
- Pagination problem after WP_Query with tag filtering
- pre_get_posts filter meta_query without conflicting existing meta_query
- Get list of terms that have posts in another term
- Get data of all posts of a query before pagination
- How to avoid wp_query returning the same post I’m on in results?
- Custom query for sidebar isn’t returning results
- How to vary post loop results layout and resume?
- Adding an array from a query string to a WP meta_query
- WordPress add_rewrite_rule() cannot visit lower url levels
- WordPress Loop and $post
- How can I create ‘future’ and ‘past’ parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?
- WP_Query tax query part of slug
- How to implement a new row_count method in WordPress?
- Some doubts about how the main query and the custom query works in this custom theme?
- How to do a wp_query with two acf-fields, sorting on one of them
- Using Advanced Custom Field for file upload, how do I load the file url
- Retrieve posts using thumbnail id as meta key
- Shortcode for latest -not expired- posts
- Only display post if published in last 24 hours?
- Query Vars Not Set in Main Query
- Filter Custom Taxonomy Posts
- Config.php issue in WordPress
- Is it possible to query from external database? [duplicate]
- WP_Query freezing
- Order post type by sum of two custom fields
- WP_Query to output chosen term and posts with no term assigned
- Need to add onclick javascript at backend of my wordpress site
- How do you determine if a result in a search query is a post or a page?
- WP_Query by keyword OR post tag
- Order WP_Query results by meta key value in custom query
- Need help understanding this WP Query [closed]
- Display recent posts on another site
- WP_Query for products always returns empty
- Ordering posts by custom field and grouped by month
- Issue with data array format
- Add AJAX “Load more” on custom query block
- Meta Box WP_Query array for showing items with a certain relationship
- Multi-layered WP_Query
- `offset` WP_Query argument dont work via `pre_get_posts`
- Function the_posts_pagination() not compatible with WP_Query arguments
- Pagination of custom page with custom fields query
- WP_Query custom post with by general tags
- Why are my wp_query args being ignored if post_type = CPT
- WP_Query() not filtering posts for category
- WP_User_Query Orderby Not Working
- WordPress post_status and meta_query
- WordPress Query optimaization for slow query
- WordPress – just refresh blog archive by new query
- how to move a page from one drop down menu to another drop down menu
- How to pass a php variable to js within a template?
- Meta query doesn’t remove placeholder escape before query
- Multiple values in WP_Query : category__and
- Custom query: post__in parameter causes query to be empty
- Custom query return
- Show subscriber id in loop
- WP_Query: Meta_Query with serialized value (or a workaround)
- Query All Attachments and Order by Parent Publish Date
- WP_Query using meta_query with LIKE doesn’t return what it should
- Query post Pagination Problem
- How to organize a WP_Query’s list of posts by category and display category title?
- How to Query Updated Post in WordPress
- wordpress nested loop
- Pull Instagram images into an existing loop?
- Query_vars not working for me
- Query posts only shows 1
- Query custom post types by meta field in a term from custom taxonomy
- First post outside of loop, homepage only?
- Filtering product search results using tags
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- Get posts using multiple values from ACF checkbox as meta query wordpress
- How to save the results of a query as a php file for an autocomplete search bar
- Why ignore_sticky_posts argument is in sticky post query?