Using ACF Relationship field to set post type to draft or published status

There’s no sense in using the init hook because this hook will be triggered on each page load.

If you want to update pages’ status every time when someone updates a field, you can use any of the following hooks:

  • acf/update_field – this filter hook fires every time when a field is updated before it is saved into the database. This hook is a part of the ACF plugin.
  • update_post_meta – this action hook fires every time when a field is updated before it is saved into the database, but it is a part of the WordPress core.
  • updated_post_meta – this action hook fires every time when a field is updated after it was saved into the database. This hook is a part of the WordPress core too.

The first one passes four arguments into its handlers: $value, $post_id, $field, $original. You can learn more about it here.

And the last two hooks pass four arguments into their handlers: $meta_id, $object_id, $meta_key, $meta_value. You can learn more about them here and here.