Hi, I have two CPT UIs Custom User and Ability.
The Custom User is a post type and not a WordPress User!
For each Custom User post you can set a set of relationships pointing toward a Ability post.
When viewing a Custom User post I set up a query to show the Abilities which the User contains, which is working.
By selecting Ability as post type and creating a Meta Query.
The meta query has a dynamic Meta Compare field as following:
Now I also want to show in a Ability post which Users possess that Ability and this is not working.
As post type I selected Custom User for displaying some User fields.
And for the meta query the following:
Meta key: rability because I want to compare that to the current post.
Meta value: I would like to select the current post, but not sure how to, so the error is probably here?
Meta Compare: = because every entry found should be the same.
ACF Relationship querying should work. I take it that you are using a primary query with a nested query inside the query template.
Did you try setting the Meta Compare to LIKE for rability?
As the first example, when I am in a Custom User post, the ACF Relationship querying is working perfect.
Not quite sure about the query template
Im in a Ability post.
primary query: looking for all Custom Users by setting my Post Type to Custom Users?
nested query: my meta query?
The = and LIKE both deliver the same result. They display all Custom Users, which haven’t any assigned Ability post.
Edit: In a Custom User post the RAbility Relationship can possess multiple Ability posts.
Maybe I’m misunderstanding here, but can you confirm that you are using 2 query blocks?
One being the main query and the second one, placed inside the Query Template block, to process the relationship?
Not if you want to query the relationship for every single item within the primary query, otherwise the post id will not be correct. That is how ACF recommends doing it: ACF | Querying relationship fields
Hi @Louis,
I tried different solution and it probably all boils down, that as mentioned I still do not know how to add a current post as a query meta value field.
One main one and then another one querying your meta field and value.
The second one has to be within the first one’s Query Template block, so that it gets repeated and can pick the correct Post ID.
Hi @Louis,
thank you for your reply.
I tried solving the problem with 2 Query blocks, but was not able to find a solution. Doubting my comprehension of these queries… seems that I do not understand this problem.
Not quite comfortable asking to be spoonfed this problem, but would it be possible to fill in the image below with the “Doctor/Locations” ACF Solution that you linked before?
Hi I am working on a similar project. I am new here, this is my first week. My question is did you ever figure this out? I was already on the right track by adding a second query in my primary query, but I am unclear on how and what settings to use to pull the related information. My relationships is bi relational… meaning i am not sure there is a parent child, they are synced. I am trying to pull in an imave from teh related post type into the first post type query loop. Almost there but i cant figure out the settings for the second query loop. By the way it is great that we can in fact add additional query loops to a primary this opens up endless possibilities. I also am not good with code. i can copy past and manipulate as directed btu that is the extent of my coding abilities so i am looking for a settings solution or a completed code snippet to past.