The Answer is: Nothing. These two snippets SHOULD return the same posts.
However, there are a lot of things, that can change a query before it is executed: plugins, your own theme by a pre_get_posts Filter. So to check if it is an error in this code or some other code, you can disable all plugins, switch to a standard theme, and THEN test your snippet again.
Related Posts:
- Get all image from single page using this query
- simple sql query on wp_postmeta very slow
- wordpress query – orderby child post date
- Add multiple value to a query variable in WordPress
- wp_dropdown_categories with multiple select
- How to tune search argument in WP_Query to show only exactly the same results?
- Custom query filter not working on woocommerce category page
- How to get my loop to pull posts into three columns
- Custom $wpdb Query for Custom Post Type by Category
- Can’t pass table to $wpdb->prepare
- WordPress creating excessive joins on meta_query with search
- How to display liked posts of current user in wordpress?
- Date query year and month OR just year
- Are database queries created using WordPress filters protected from SQL injection?
- get post id using the $query_vars variable
- How to remove duplicate query on page load or make them cacheable
- Is there a conditional tag for latest post or do i need a query?
- wpdb::prepare() isn’t working
- How can I apply a meta query for a single custom post type in the main query?
- get_posts() loop returns the same the_title() for each post
- Huge amount of queries on my site
- How to check current user in meta value array in WP_Query meta_query
- How select a specific query when setting offset?
- Change media attachment author via mysql query
- Get post according to current taxonomy
- Temporarily storing main search result
- Help with MySQL to $WPDB query
- Alter query with posts_clauses to retrieve NULL values last
- sql select query in wordpress ‘page’ [closed]
- wpdb->term_taxonomy count posts from both published and private posts?
- Query based on title, with ‘compare’ => ‘IN’
- Group custom post listing in admin section
- Plugin will sort users by usermeta
- problem with sql query in wordpress plugin
- Attempt to improve WP search, can someone check my SQL query?
- WordPress Query orderby title with UTF8 string in title
- Searching With Apostrophe
- Query posts according to specific post meta values
- List author’s posts with SQL
- Where is the query in wp-login.php
- Order posts by recent comments
- query if page has not child
- empty query breaks other queries
- Problem in exploding the_content to array
- get_posts showing only 5 posts. (nopaging and posts_per_page -1 not working)
- Order by title – but now built in wordpress func, sort the_title
- Display posts between two particular dates
- pre saved posts query from db options table
- Order posts by date, but also give priority for a specific term
- $post->ID not working in combination with a custom query
- Custom Query returns array, but I can’t see it’s elements
- how to insert missing tags into the posts through mySQL?
- How to insert Collate into WordPress search query?
- Combine “Exclude” Query in functions.php
- Optimize slow SQL query for multiple meta values
- prepare function sql safe method
- Wrap/close ‘query’ for a first-letter ordered listing of posts
- wpdb query with dynamic column name?
- How do you display the number of a post in a query?
- How to return count of custom post type posts with a specific custom field value via $wpdb?
- How to rearrange a pool of posts joined using two queries?
- How can I get the name of term post meta value which equals term id
- Help with Related Posts Function
- wpdb update multiple row?
- Trying to use WP_Query to return post with and without meta values
- Custom query Custom-Post-Types creates error
- Formatting a date/time returned from a custom $wpdb query
- Rewrite rule for query params
- get products by custom date variable
- How to delete all images from code in all post_content
- How to sort by two meta keys in admin area?
- Hook into the Admin Dashboard and redirect users
- Prevent versioning for .woff (font) files
- Orderby event date (if it exists) or post date (if it doesn’t) – how to reorder posts based on meta value OR date
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Modify behaviour of “s” parameter in wp_query
- OR condition not working
- Query not returning child posts for any parent post ID
- How to make MySQL search queries with quotes
- Limiting a filtered query
- Use $wpdb->get_results with filter based on array
- Add Hook for clearing transient when post is added
- Archive query not working correctly
- Custom MySQL Query for Post and Post Meta
- Displaying popular posts
- How to have more post in a page than in your home page
- Find all posts via SQL beginning with A of type B
- Show links to child pages on both parent AND child pages
- Display old posts if no future posts exist
- Access Tables with number prefix
- Modify Global Posts Plugin
- How to reference same column name but different table in custom db query
- Retrieving custom field array value through db query
- how to add a read more button to my blog page?
- SQL Query : how copy all tags of post into their post content in wordpress by sql query
- How to add multiple values with add_query_arg?
- Query parsing only author ids
- 3 queries to update WordPress
- Query filter on custom post by current author in post widget for elementor query id
- Querying Posts from ACF Repeater Subfield Select Value