Custom Fields
Re-Envisioned
Support MB Settings Page Delete options field MB Settings Page

  • Creator
    Topic
  • #11158
    Resolved Infolu
    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

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #11210
    Anh 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 1 replies (of 1 total)
  • You must be logged in to reply to this topic.