Support

Account

Home Forums Bug Reports ACF PRO: Possible bug in acf/save_post Reply To: ACF PRO: Possible bug in acf/save_post

  • What I’m trying to do is compare the old and new values of a field when a post is saved using acf/save_post with priority 1, which is supposed to run before ACF saves the $_POST[‘acf’] data.

    The field values always comes out equal, which they are not supposed to do, right?

    Example data:
    field_abc123 old value: Title One
    field_abc123 new value: Title Two

    Example code:

    function compare_field_values($post_id) {
        // Print old and new field values
        var_dump(get_field('field_abc123', $post_id);
        var_dump($_POST['acf']['field_abc123']);    
    
        // Exit to be able to debug the field values
        exit();
    }
    add_action('acf/save_post', array($this, 'compare_field_values'), 1);

    So, anyone have any idea on how to solve this? Or is there a bug in ACF when setting the priority to 1 on acf/save_post?