Just pass the array as the second argument to update_option
– WordPress will serialize the value before storing it in the database, and automatically unserialize it when you read it:
update_option( 'meow', array(
'cats' => '2',
'food' => array( 'tona', 'fish' ),
) );
$meow = get_option( 'meow' );
print_r( $meow );
// Array
// (
// plugins => 2
// [food] => Array
// (
// [0] => tona
// [1] => fish
// )
// )
Related Posts:
- What are the common security flaws I need to look for? [closed]
- Creating a WordPress admin page without a menu for a plugin
- Creating a user’s own folder on user registration
- Common functionality between my own plugins
- Problem requiring/including plugin files with plugin_dir_path( __FILE__ )
- How To Ignore a Filter On Applying Filter the Content In a Function
- Which functions in theme or plugin load first
- Adding Image in readme.txt file of wordpress plugin
- Saving Plugin settings to the database
- Add CSS animation as Preloader to WordPress
- remove custom taxonomy metabox form custom post type
- $wpdb->get_results() does not fetch results with unicode ‘WHERE’ clause
- Deleting images through upload folder, but not deleting from media library
- how to use ajax to display from database and load more in wordpress plugin
- WordPress plugin installation
- Get image URL from media library in input
- How could I execute my plugin just in frontend (not in backend)
- Create or Update thousands of woocommerce products via PHP
- Custom height/width for thickbox in WP Backend
- add action wp_head not working
- Update Option Error: Notice: Undefined index
- Why this global array is returning NULL from a callback function
- Next and/or previous post content
- Why my Plugin keeps deactivating automatically?
- Self deactivate plugins after an action occurs
- How to get current post user id
- How to periodically scrape and cache strings from remote txt files. – My First Plugin
- switched from query_posts to WP_query, not working now?
- Using a custom plugin to capture input data via Ajax and PHP
- Display post lists in 2nd paragraph
- Ajax contact form widget plugin data not insert in database
- Install Plugin via Code
- Single API call exposed via shortcode with params
- How to output CMB2 select options from repeated groups select elements?
- Is there a way to test that readme looks in other language before submitting translation?
- What would I need to write into a custom plugin in order to add a switch for a custom string of CSS to the edit page?
- Homemade plugin while using Themify Ultra
- How to deal with WordPress and Pocket API to automate content curation on my hosted wordpress blog? [closed]
- WP All Import – Execute Imports
- Create tabs in admin options page from custom post type loop
- ob_start() combined with wp_query
- do_action() hook into load-(page)
- WordPress get_avatar function not correct working
- How can i create page through plugin
- Can I use Symfony components in a plugin that I want to submit to the WordPress plugin repository?
- Custom license for WordPress plugin
- Does using `add_action( ‘init’…` cause performance issues?
- Custom Login Page — wp_signon Headers Already Sent?
- Add_rewrite_endpoint doesn’t work with post name permalink structure
- How to create plugin/ page that reads from database
- Why is my WordPress Plugin page requesting my FTP Login Credentials?
- Cross Sells are not being shown in Cart Page. Please Help!
- Plugin not properly prepared for localization
- WordPress Active Plugins
- adding custom code as a wordpress plugin
- How to add filter for wordpress plugin?
- How To Create A File Archive in WordPress?
- Adding a jQuery modal dialog to the admin area
- Custom Post Type, Custom Columns List
- wp_query ‘s’ parameter does not work with WC_AJAX
- Monitor all the queriers executed by my website
- Dotenv file in custom plugin
- Allow a particular user to access a particular plugin?
- wordpress plugin add page when activate
- Add style to body based on url
- Getting the same post on my related post
- I want to schedule email (date, time is in database->table) wp_schedule_event() not working
- How to create a plugin with automatic update?
- How to remove WordPress Default Comment? not Facebook
- How to use Datatable with Ajax when creating plugin on WordPress?
- Loading plugin script only on required page?
- Create survey that redirects to sidebar menu customized to answers
- Uploading images to custom table
- Changing author slug for a custom role without using plugin
- plugin operation launch every time i click on page
- Plugin Version List not Shown
- WP options plugin setting not saving the selected checkboxes
- How can I customize Easy Appointment plugin?
- How to change meta data(title, description) for current post?
- how to add custom css at top above all css file for specific url
- Provide http service by wordpress plugin
- Coming soon pages with rest of site in maintenance mode
- insert multiple entries in database using a loop issue
- create web service for android app using wordpress website
- Web Application Framework Compatibility with WP Plugin
- Plugin Works, but Widget Doesn’t
- Plugin loaded, but not running
- Merge custom plugins in one folder
- Execute certain function on GET request
- Filter EVERY category link with my plugin
- Undefined variable _POST
- How to create a nameplate extension? [closed]
- Template selector for woocommerce product
- How to access values from your own settings page in javascript?
- How to load plugin static data from cloudfront
- How to Replicate Elementor Licensing Model
- How do I save meta key value in the save function?
- How can I view forums from different sites in a single panel? [duplicate]
- The Best Multilanguage Plugin supporting the FSE [closed]
- warning wp session