Support

Account

Home Forums Backend Issues (wp-admin) Get post status in acf/validate_save_post

Helping

Get post status in acf/validate_save_post

  • I’m adding validation to a certain post type to prevent a user from publishing a post if criteria is not met. However, I only want to run it if the post is moving to the ‘publish’ status. Is there a way to get this during the “acf/validate_save_post” action hook?

  • When a post is updated acf includes $_POST[‘_acf_post_id’] and you may be able to use this to get the post status. But ACF is unaware of a post being transitioned to publish status.

    When saving a post you would also need to look at the standard fields for a post that WP uses an check these to find out if a post is being published.

    There are also multiple ways that a post can be published and some of them do not cause a submission of the post. For example you can publish a post from the quick edit menu.

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

The topic ‘Get post status in acf/validate_save_post’ is closed to new replies.