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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.