I have two custom post types: one called Artwork and one called Artist.
Artwork has a custom post_object field in which the user selects the Artist that created the artwork.
The Artist custom post type has a custom ‘surname’ field.
Custom post type 1 = Artist.
Custom post type 2 = Artwork.
Custom field on Artwork = post_object Artist
Custom field on Artist = Surname
Getting the artist name is easy once I’ve got the query results – get_field(‘surname’,’artist_id’) – but I want to be able to order the Artwork results by the Artist’s surname which means doing some kind of pre_get_posts thing on the query based on the post_object field id.
I’m looking to use wp_query rather than a custom select query because I’m using hooks from an existin plugin.
Any help or direction would be greatly appreciated!