Support

Account

Home Forums ACF PRO acf/save_post and api/admin columns

Solving

acf/save_post and api/admin columns

  • what is the correct method to trigger the hook acf/save_post when we update a record via WP REST or via a supported 3rd party such as admin columns with their bulk/inline editing?

    Cheers
    DT

    Current logic
    add_filter('acf/save_post', 'acf_fields_edit_webhook', 1);

    function acf_fields_edit_webhook($post_id) {
    // do something
    }

  • I happened to content ACF support about this recently and got this response. I was specifically interested in updates via REST.

    I am afraid the acf/save_post action hook in WordPress is intended to be triggered only when a post is saved or updated via the WordPress administration interface (the back-end), and it wouldn’t be triggered for updates made through the REST API or other programmatic means. This was because the acf/save_post hook was designed to be tied to the post editor’s actions.

    If you want to perform additional actions when a post is created or updated through the REST API, you can use the rest_insert_post(rest_after_insert_{$post_type}) and rest_after_insert_post(rest_after_update_{$post_type}) hooks, which are specifically provided for handling REST API-related post actions.

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

You must be logged in to reply to this topic.