Home › Forums › General Issues › Getting Field Value of A Different CPT through Relationship with WP_Query › Reply To: Getting Field Value of A Different CPT through Relationship with WP_Query
You cannot to want to do. You cannot query or order posts by a relationship field or by a value of the related post.
In order query by this value you need to copy the value to the post(s) that you need to use it for. You can do this using an acf/save_post filter that runs when saving post type “solution”, get the value from the related “vendor” and store it in the meta table attached to the “solution”
Another possibility is to query vendors to get a list of sponsored vendors and then somehow alter the solution query using the list of posts returned.
Sorry, I don’t have example code for doing either.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.