I think I got it. You’re querying for sticky posts. Attachments can’t be sticky at least by default. Hence, you’re see the normal loop order when sticky posts are involved. So if you add this to your second args array:
'ignore_sticky_posts' => true
I think your problem should be resolved.
Here’s the relevant codex section on that argument.
Related Posts:
- WordPress query reverse order
- Order by & include array by specific post ids
- How to create an attachments archive with working pagination?
- query_posts doesn’t order by title
- Order by meta_key with two meta_queries
- Ordering terms before displaying posts
- How can I pick a single post from the latest 3?
- orderby:date not working
- WordPress query_posts and orderby page order
- tax_query operator woes
- Order posts by condition
- order posts by meta value on posts page
- Sorting a query Field by date
- define orderby URL with meta_key=post_views_count
- Query_posts and attachments
- post_parent array doesn’t work
- how to store wordpress loop in array?
- WordPress wp_get_attachment_thumb_url full
- How do I get a array, with the right order of the nested comments?
- How to get any type posts include attachments by ids?
- Ordering of posts, 2020 Year showing as next event when should be last
- Order posts by ACF checkbox
- Adding Category Argument into an Array for WordPress Query
- Query specific posts from parent by slug rather ID
- How do I find the first item in the post array?
- Why query_posts() isn’t marked as deprecated?
- how to query posts by category and tag?
- How do I query by post format in WordPress 3.1
- How to set posts per page using WP_Query()
- Limit the post for differents custom post type in the same wp_query
- Custom Post Type “Event”: chronological list of recurring events
- Order by meta value, pro first, then free
- how could I get the pagination as I want to when query posts using get_posts function
- Counter code for paginated category pages in wordpress
- Author List page: Exclude based on last post date
- Replace query_posts with pre_get_posts
- query_posts sort in multiple directions
- Filter query_posts by tag slug on “Tag Archive” page (when tag is 2 or more words)
- Warning: urlencode() expects parameter 1 to be string, array given in and not getting the preffered output
- Using database meta_values to calculate new post order using pre_get_posts or a ‘request’ hook
- exclude ids through post__not_in
- Display custom post types with custom date field value (before today) & order by custom date field
- Different number of posts on the front page
- Query posts without a specific ID
- Integrating post archive wtih another source and preserving date ordering
- post_author for wp_insert_attachment
- Order posts using a custom array
- How to check the array of featured images IDs
- Ordering of gallery images without using shortcode in theme
- Show Only Posts Owned By Logged In User + my post
- Custom MySQL Query with logic
- Getting the ID of any image for use in functions.php
- trouble with query to fetch next and previous posts
- Simple custom post query for all the posts or many of them not working
- Hook to return true when the_post() is used in a custom while loop
- How to remove a plugin filter’s priority on specific loops (custom queries)?
- Query all posts if multiple meta key don’t exist
- Proper syntax to add boolean in array()
- get_the_title outputs title until spacing; it does not get full length of title
- using query_posts to pull posts out of a category in a while loop. Getting odd echo
- Echo a numerical value in query_posts
- why to use query_posts() in custom page?
- Query posts to get all but the most recent post
- Always using the same ARRAY on different querys
- Include current post into loop
- Display trimmed version of the_post()
- How to create a multidimensional array with multiple loops
- Post per page not working if no category specified
- How do I use pagination in WordPress?
- Querying multiple values from a single key
- Does WordPress run a post query when a page is invoked?
- How do I add a relation parameter to my filter query?
- query_posts with meta_value
- How exclude 3 latest posts of a category in query_posts
- Multiple posts/pages in one page?
- Determine if ID is page or post and query the ID
- How to check a list or feed of all posts under a category and tag?
- Issue with sidebar widgets not showing when I do custom queries
- Why would post_type be ignored in this query?
- query_posts call sets is_home() to true
- Calling Posts from Specified Cat
- How do I add a timezone offset to this query?
- query_posts thumbnail condition
- Show posts from specific roles
- How to add an “or” instead of and “and” (&) in a WordPress query?
- Instead of 4 loops, how can I do it better?
- Modify main loop query for paged and meta key
- wordpress query_posts featured page always on top
- Need to add a space after meta value in query_posts in wordpress for zipcode search
- Tax query get first product with attribute value in pre_get_posts
- Help with query_posts function
- Ordering Posts By Meta Data
- No duplicate tags by category
- Issue with WP_Query (need a array of selected ID’s)
- why is pre_get_posts not working
- If meta_key has value = 6 | Change the wp_posts.post_date to current date
- Query posts based on parents attribute
- Query Posts (post meta)
- Including post data in a sidebar occurring outside of and before the Loop
- get all posts with certain meta data