You can’t, WP_Query
can sort by post meta value, but it can’t then use that value as a post ID, look up that post, then sort by a value on that other post.
If you had a small number of posts, it could be done by manually sorting the results with PHP.
Fundamentally, the data is not stored in a way that makes this feasible.
Related Posts:
- Sort Order for a Custom Query in a Post Type Archive Not Working
- Select All in Parent Category, Group by Child Category?
- WP_Query -> sort results by relevance (= most tags / taxonomy terms in common)
- WP_Query post at custom position
- query order by date on custom type: wrong order
- Re-order posts in query after
- How to query different post types in specific order?
- is_main_query() not working for WP REST API
- Combining sorted and random CPT
- Previous/Next Link by Meta Value in CPT
- Wp_query: sort by PHP variable
- How to do WP_Query with two meta fields with orderby clause
- Order Custom Post Type by Custom Field Value
- Change sort order when using ‘orderby’ => ‘type’
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- WP_Query of custom post type sorted by meta_key has unexpected results
- WP_Query not resetting after wp_reset_postdata
- Post ordering not working with custom field
- Displaying Portfolio Filter by Category Order (alphabetically)
- wp rest api orderby field in a custom table
- Display Parent-Child Posts in specific order by comparing IDs in array
- WP_Query: how to search tags in addition to a custom post type?
- Order posts alphabetically with numbers but some of the posts has numbers in the title
- SEARCH QUERIES – REVERSE OUTPUT
- Wp Query sort order from custom MetaBox
- WP Query with multiple post types ordered by custom meta date then published date
- Orderby modified only for specific post types
- Custom post order when using OR relation
- 404 on Pages for Custom Post Type & Query_Posts
- WP_query orderby not working after WP4.0 update [closed]
- Store custom post type with JSON content
- querying to custom field over ACF REST API
- Query order by meta value force specific tag first
- Order Wp Query by earliest of 3 dates meta query
- Query all posts where a meta key does not exist
- Syntax to get the Nth item in a list of custom post types?
- WP_Query to loop a Custom Field, Custom Post Types do not show
- Compare 3 custom fields and sort by oldest
- Using Query Posts With Multiple Post Types And A Taxonomy
- How to show posts from multiple post types in a single loop? And display them separately on the same template
- Custom Taxonomy List links being re-written
- Can’t sort order of wp_query with 2 meta keys
- Want to filter only parent post in admin area
- Get count of custom post type created by current user
- Query Custom Post by Category
- Quickest way to get last or oldest post date – WP Query
- Display posts if a custom field value is equal to another custom field value
- WP_Query and using a variable for ‘cat’=> in the args array = WP Bug?
- Custom post query by taxonomy
- CPT posts listed by category with custom rewrite URL, please help!
- Group custom posts by custom taxonomy names
- Using global $post; to get featured image for custom post via WP_Query
- Query custom post type by category slug
- Can’t query tag and post_type at the same time
- Wrong request query on cpt and tax
- Search / Filter posts on Title/Content OR Tags
- How to order separated Custom Post Search results
- Converting the_content string to an array?
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- Display Woocommerce Orders for specific author [closed]
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- How can I group posts by months and years?
- Displaying a div from an assigned meta_value when on a page
- Creating two loops based on different logic
- $wpdb->get_col and ORDER BY?
- Getting a custom post’s custom field based on another custom post’s custom field select
- Custom post type loop with custom category filtering
- Show message when query has no posts
- How to show all taxonomies within custom post type loop
- Foreach loop returning more than one item when querying taxonomy
- how to compare different timestamps in wp-query for events custom post types?
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Sorting the Loop by Taxonomy Value
- Previous / Next Links For Custom Post Type Sorted By Meta_Value
- Ordering by meta value not working
- Custom wp-query display post only today
- How to sort by multiple values in a nested WP_Query
- WP_Query to display number of custom post type filtered (order by) taxonomy
- 2 modal windows with ACF content on Archive page
- post_type incorrect for custom post type
- Live search by custom tag
- Custom Post Type – Display all, wrap in groups of 3
- How to get the posts that my following users are liked?
- Only show categories that have posts within custom post type
- How can you use a page for a custom post type?
- Display all Custom taxonomy terms and their relevant custom posts
- CPT Efficient way to display posts from different categories with custom query
- How To Loop Through list with Custom Post Types
- CPT or Custom Table for Repository of Serial Numbers
- Query Pulling the same post twice
- Use Tags to Query Associated Multiple Posts and Get The Average Of Custom Field Values
- Custom Post Type + Category archive
- Values inside a custom field to determine which category posts to display
- Pop up showing same content on all posts display.
- Custom post-type’s pagination not working in category.php
- Listing all custom post types using a specific term on the said term’s template page, in groups
- Count of posts with meta_key filled in?
- Are custom posts included when getting a categories’ posts?
- Can I add a wordpress page using the slug for a CPT rewrite
- Query order by a numeric ACF field