Forum Replies Created

  • Hi,

    I know this is a couple of years old, but hopefully this will save someone else some time.

    The work around I wrote uses the ACF filters to make sure disabled fields could not be accidentally overwritten by an admin page that was left open and then saved after the meta has been updated elsewhere in the code. Example:

    function my_acf_update_value( $value, $post_id, $field, $original ) {
    		// if the field is supposed to be disabled, return the live meta value
    		$value = get_post_meta($post_id,$field['name'],true);
    	return $value;
    // Apply to all fields.
    add_filter('acf/update_value', 'my_acf_update_value', 10, 4);

    Now, if you want to update the meta value elsewhere, you will now need to use update_post_meta() as update_field() will use the above filter.

Viewing 1 post (of 1 total)