Support

Account

Home Forums Backend Issues (wp-admin) Exclude assigned posts from post object results

Solved

Exclude assigned posts from post object results

    • abhigt

    • December 28, 2019 at 11:53 pm

    There are two custom post types. Restaurant and CityGuide
    I am using post object to assign restaurant in cityguide.
    I want to exclude restaurant from post object results which are already assigned in another city guide.

    I’ve tried using acf/fields/post_object/query filter but it didn’t help.

    It would be greatly appreciable if it there is any solution for it.

  • That is the only filter that you can use.

    In that filter you would need to do a query of all “cityguide” posts and collect a list of restaurants already assigned and then use the “post__not_in” argument to not return these posts.

    • abhigt

    • January 3, 2020 at 8:22 pm

    Thanks @hube2 for your help.
    I need to loop through the CityGuide posts and retrieve the assigned restaurant ID’s then supplied those retrieved IDs in โ€œpost__not_inโ€.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.