The WPFolks app is out on iPhone and Android. Free, no ads. Download on the App Store Get it on Google Play
Skip to main content
Login Join
Snippet · PHP

Run Code When an ACF Field Is Updated

Shared by Bharat Kathiriya · August 26, 2026

13 views
2 upvotes
Back to Snippets

This is particularly useful for automation.

Whenever featured_product is updated, another piece of post metadata is automatically updated.

add_action('acf/update_value/name=featured_product', function ($value, $post_id) {

    if ($value) {
        update_post_meta($post_id, '_has_featured_product', 'yes');
    }

    return $value;

}, 10, 2);
Know a different way to do this? Add your approach as a variation so folks can compare them side by side.
Submit a variation

1 comment

  1. Amit Dholiya
    Amit Dholiya @amitdholiya

    Handy pattern for keeping post meta in sync without manual updates.

    Report