I think changing array keys is more of a PHP problem
// Get entire array
$plugin_options = get_option( 'plugin_options' );
$new_options = array();
if( isset( $plugin_options['ga_accountId'] ) )
$new_options['ga_account_id'] = $plugin_options['ga_accountId'];
// Update entire array
update_option( 'plugin_settings_general', $new_options );
// Delte old array
delete_option( 'plugin_options' );
Any end-user who might be using using your plugin’s options for something in their theme, will get errors. But if you are going to rename things, plugin_settings_general
should be name-spaced with your plugin’s actual name.
Related Posts:
- Updating Woocommerce Settings API when WordPress Settings API saved and vise versa
- Settings API with arrays example
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is it mandatory to use $wpdb->prefix in custom tables
- Is get_option function cached?
- How to Use Checkbox in Custom Option Page Using The Setting API
- How should one implement add_settings_error on custom menu pages?
- Default table collation on plugin activation?
- Accessing plugin settings in gutenberg
- Using a database view = evil incarnate?
- Getting wrong relationship value in $args in wp_Query?
- WordPress and multithreading
- Nonce in settings API with tabbed navigation
- What is the added “complexity” of custom tables?
- How is the data stored in the database?
- How to modify post content before writing to database?
- How to use the settings API to set multidimensional arrays
- Actions or filters fired when data is saved in a custom table
- Why won’t register_setting() create a setting?
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- Is there any reason only 1 (my) IP would be added to this table using $wpdn->insert?
- How to store data for posts/pages built with drag-n-drop builder?
- What is the use of get_option method
- Extend plugin options page
- Generating User(s) with Settings API
- Callback function is being called twice
- What for the tables ending with the meta used in database of wordpress?
- Correct way check nonce (security) using old Options API
- Creating table with plugin is not working
- dbDelta() Error – Incorrect index name ” for query ALTER TABLE
- How to add settings subpage from a plugin to a settings page created in theme?
- Update/insert only a column of database table
- WordPress setting with select – where is my mistake?
- How to Create database table when Plugin installed/activated, and delete database when Plugin deleted
- null callback in add_settings_section
- Single sanitization callback for multiple fields
- I’m designing a plugin to create database indexes. Suggestions?
- Callback is not called in add_settings_field() when passed as part of an array, but recognises that it’s there. It’s passed Class to Class using OOP
- WordPress database error for query INSERT INTO
- How to connect to AWS RDS external database (not for the core WordPress db)
- Custom delete option button in plugin settings
- Adding settings link to plugin doesn’t work
- How to fix Uninitialized string offset: error on a checkbox in WP Settings API
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Strange issue saving custom field data for a WooCommerce order
- Form doesnt save to database
- Is using custom table to suit business needs instead of transients a big hit to page load speed?
- Settings API with arrays example
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Allow users to add / remove settings in plugin
- Update problem with update_option() in combination with register_setting()
- Optimising a big WordPress site
- What is the best way to store a few fields?
- Delete data from database using row action
- How do I have now a duplicated user entry if this is not allowed (and I cannot replicate it)?
- Default settings aren’t used
- WordPress theme options Menu
- Category select options for plugin settings
- Alternative functions for mysql_free_result and mysql_ping in wordpress functions
- Issue on Checkbox with Custom Option Page
- Make Database query only when option is updated
- Can we intercept user_login and user_pass from a wp_login_form?
- Settings API: Setting default option via ‘get_option’ fails
- Two different wordpress sites – same server and IP address. Gaining Access to database 1 of 2
- settings api – add_settings_section not working
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- Multiple page plugin settings
- How do I debug an error that a plugin is causing?
- WordPress database error: [Query was empty] – using $wpdb->prepare()
- Settings API not saving
- How to get inserted row IDs for bulk/batch insert with wpdb query?
- WordPress how do I echo SUM from a column of a MySQL table by user id AND type_operation
- Hide / show settings field based on other field’s value
- Integrating colorpicker into array field
- Save in my custom admin page and redirect to the saved object
- Relational / Associate tables using native WordPress functionality
- How to store in the database directly the translation?
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- add_option_{$option} action hook not being called
- Plugin options page: grouping checkboxes
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- Associating special meaning with user id 0
- From my Plugin Settings Page use check boxes to load specific css files (e.g. Bootstrap / Foundation)
- Dropdown pages in Settings API
- How do I build a settings panel under the plugin
- What method should I use to store my plugin data (multi level menus with options on each item)
- Plugin settings checkbox
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- Add_menu_page and saving settings
- Updating Style From WP Options Setting Page
- Combo/Drop down box on plugin settings page that allows additional options to be added
- How to delete all the options in an option group
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- Admin Message after Plugin Option Updated
- How to create a database table in WordPress using PHP
- Can I log the searches that are returning 404 in the DB?
- Programmatically creating posts based on external JSON feed (asynchronously)
- Making a user platform reachable by a qr code on a pin-back-button [closed]