Support

Account

Home Forums Backend Issues (wp-admin) Unset fields

Helping

Unset fields

  • Hi every one
    how can i unset field to prevent it from saving
    this is my code not working!

    function my_acf_save_post( $post_id ) {

    if( empty($_POST[‘acf’]) ) {
    return;
    }

    $fields = $_POST[‘acf’];
    unset($fields[‘field_5964d52f052b7’]);

    return $fields;
    }

    add_action(‘acf/save_post’, ‘my_acf_save_post’, 1);

  • 
    if (isset($_POST['acf']) && isset($_POST['acf']['field_5964d52f052b7'])) {
      unset($_POST['acf']['field_5964d52f052b7']);
    }
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Unset fields’ is closed to new replies.