Support

Account

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

Solved

Exclude assigned posts from post object results

  • 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.

  • 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)

The topic ‘Exclude assigned posts from post object results’ is closed to new replies.