admin管理员组

文章数量:1122832

I have a custom post type called "team".

I created a Post Object with the ACF plugin which Filter by Post Type value of "team" and I target the WordPress Posts for the location.

The idea is to associal team member with a wordpress post.

Let's say that the admin create a new post and after that select a "team member" from the post object.

If the user visit the single member page I want to show all posts associated with the current visited member.

As far as I can see I need to use "meta_query" in the post $args and check if it's equal to the current post id but I can't make it work.

What is the right way to achieve this functionality?

I have a custom post type called "team".

I created a Post Object with the ACF plugin which Filter by Post Type value of "team" and I target the WordPress Posts for the location.

The idea is to associal team member with a wordpress post.

Let's say that the admin create a new post and after that select a "team member" from the post object.

If the user visit the single member page I want to show all posts associated with the current visited member.

As far as I can see I need to use "meta_query" in the post $args and check if it's equal to the current post id but I can't make it work.

What is the right way to achieve this functionality?

Share Improve this question edited Aug 14, 2022 at 11:58 Yordan Kostadinov asked Aug 12, 2022 at 16:08 Yordan KostadinovYordan Kostadinov 491 silver badge7 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Have you tried ACF relationships? Try this if you are looking to build a relationship betweent Team and Team Member.

https://www.advancedcustomfields.com/resources/relationship/

Here's a perfect example - https://www.advancedcustomfields.com/resources/querying-relationship-fields/

Let me know.

本文标签: Show posts associated with ACF post object and custom post type