You only need to register one setting and then just modify your form inputs to save the values into an array. Here’s an example of registering the setting:
register_setting(
'mytheme_settings',
'mytheme_settings',
'admin_options_sanitize'
);
$mytheme_settings = get_option( 'mytheme_settings' );
and the field markup:
<textarea name="mytheme_settingsAdmin Options page. Save as Array">
<?php echo esc_textarea( $mytheme_settings['title'] ); ?>
</textarea>
You’ll also need to combine your sanitize functions, modifying them to work with the values in the new array.
Related Posts:
- Get categories names as an array to use it in theme settings
- Metabox repeating fields – radio buttons not saving correctly
- How can merge two arrays values in one array and save in database
- renaming an admin menu item with decimal array index number
- Jquery no more loading, load-scripts.php not found (404)
- Admin Bar (Toolbar) not showing on custom PHP file that loads WordPress
- Installing wp3.2.1 on IIS; getting empty sessions
- Compare two meta key values against each other inside the get_posts array?
- Adding Field to Profile “Name”
- Need to get specific data from array
- Create an array from an array
- WP_User_Query order by meta_key that is an array
- When is is_admin() available?
- Unable to set right time in admin and frontend template
- Can an array be used as a meta_query value?
- List of posts by day of the week
- List User order by ID in Descending order (Backend)
- ‘orderby’ => ‘rand’ alternative for better performance?
- How to convert objects into arrays
- PHP get the first post separately from array returned by wpdb->get_results()
- how can i show only the parents in owl-carousel?
- How can I add multiple ‘tax_query’ arrays via a loop?
- How to properly loop through these external URLs to get them into the sitemap using this hook
- Call global variable array() in woocommerce child/template
- Correct folder permissions?
- Populate dropdown with Child Pages based on Parent Page chosen
- foreach loop still echoes array
- Building a WordPress App
- meaning of (array)function()
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to use if statement in an array? [closed]
- Get html data with javascript to php array and store to wordpress database
- How do I create a numbered list with PHP? [closed]
- How to use array in function to get only value I want
- retain querystring values when savincustom options in admin
- How to use two meta_compare in an array?
- Warning: in_array() null given in PHP function
- Foreach loop inside an array_merge
- How to access or parse key/values that have “string”
- Conditional multidimensional arrays and array_map
- Getting posts to exclude from array
- extract serialized array to use for wp-query
- get users search not working with array
- how to make an array of post id’s in is_single
- How can I split my query result in 2 arrays?
- Multidimensional Array
- Get css class of menu item in custom menu structure
- Dynamically adding filters
- Order a WP_Query by meta value where the value is an array
- Only load certain artists on this page
- How to make sure relative URL works when site is not on root domain?
- Get URI from PodPress using PHP
- Finding and removing duplicates within WP Arrays
- Adding a ‘style=’ bit to image_send_to_editor output
- Using multiple variables to assign categories to an array
- Limit ‘contributers’ abilities in WordPress
- Custom functions for string data calculations
- Repeat a function with 24hrs gap for n number of days
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Order users by random not working?
- PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
- problem connecting to the administrator
- how to separate an array into different arrays and save them into db?
- How to add a DELETE button to the “Edit User” WordPress admin page?
- ACF – Get ID of relationship field in flexible content
- Replace an array (with identical values) with another array in the_content
- Editing the term_order field
- WP post meta – for loop inside for loop
- Combine multiple queries, array_unique returns nothing
- Store custom field’s multiple values in one user meta key
- get_users when from meta key that has serialized values
- make an array in wordpress cusmization api?
- Trouble with checked() for array of multiple checkboxes
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- Get a list of tags present in a paged front page
- How to use foreach and if statement within array of arrays?
- wordpress ajax return 0
- Add custom filter to register data in array
- Page returning ID from array, how to return the correct values for post in acf wordpress
- WP_Post is not from correct array
- Dynamic form variables for post meta
- Auto remove empty values in array
- Include administrator in author list
- Display a post based on its metabox selection
- Unserializeing multiple column values that are stored in one database results variable
- Adapting a php array to WordPress
- wp_get_archive for category returning different URLs on different but similar sites
- get_permalink returning first letter
- How to print array of specific item
- What is this mark for “? function()” [closed]
- How to combine array info [closed]
- One folder to be accessible by one user
- Force array to be a string [closed]
- get_body_params() is always empty in POST request
- Grabbing value of input field inside of array
- save array of objects with update_option
- Custom WordPress Function – Adding items from Foreach Loop into an array and Updating Field based on array of IDs (ACF + WooCommerce)
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- AJAX WP_Query’s order and orderby parameters not working
- PHP – Converting elements to actual values