0

I am using ACF Pro to make a relationship between two custom post types.

One CPT is a thing and the other is a Container of Things. I need to solve the issue of things within a container of things being visible when container of things has been unpublished.

I think using something like pre_get_posts to filter all queries that happen before any results get returned is the solution, but I am not 100% sure. Or perhaps some way to unpublish all things when the relationship field post becomes unpublished.

Has anyone else encountered this issue?

1
  • ACF dev support questions and other 3rd party plugin/theme dev support is off topic and not in this stacks scope. You should ask via their official support routes or in their groups and communities.
    – Tom J Nowell
    Commented Jul 13, 2022 at 15:20

1 Answer 1

1

You should probably check out pre_post_update.

Use pre_post_update to check for a post update within your custom post type Container of Things. Check for your conditions. Then, get the connected Things and use wp_update_post to unpublish these posts.

1
  • Okay, I like this angle. Thank you for your input. I will try to implement something along these lines.
    – Jordan W.
    Commented Jul 13, 2022 at 15:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.