Delete options field MB Settings Page

Support MB Settings Page Delete options field MB Settings PageResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #11158
    Infolu OfficialInfolu Official
    Participant

    Hi I know that I can update fields with the below condition

    // CODE UPDATE
    $option = get_option( 'settings' );
    $option['new-text'] = $option['Text-old'];
    update_option( 'settings', $option );

    But now I need to know the way to get a field and clear that field just and not any block of options using wordpress delete_options

    I need to clear old fields so that it does not hide space in the database.

    Thanks for the great work with Meta Box

    #11210
    Anh TranAnh Tran
    Keymaster

    Hi,

    The old field is an element in the option array. To delete it, simply unset it:

    $option = get_option( 'settings' );
    $option['new-text'] = $option['Text-old'];
    
    // THIS
    unset( $option['Text-old'] );
    update_option( 'settings', $option );
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.