Support

Account

Home Forums Backend Issues (wp-admin) acf/save_post on first save – meta not displayed in the form

Unread

acf/save_post on first save – meta not displayed in the form

  • Hello
    here is my code, I create a product when I first save a custom post type

    add_action( 'acf/save_post', 'aph_save' );
    function aph_save($post_id)
    {
    if (!empty(get_field( "_aph_product_id", $post_id ))) {
            return; // already got the product so we don't create it again
        }
    
    // create woo commerce product
    // ...
    
    // save product_id to acf 
    update_field('_aph_product_id', $product_id, $post_id);
    
    }

    the problem is that the meta field _aph_product_id on the custom post type form is not update just after the save action, I have to refresh the WP edit page to have it displayed. Is there a way to force the refresh of the form ?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.