Your problem is that serialized strings contains escape slashes that are not evaluated as such, because the wrapping quote is a single quote.
You are using:
$v = 'a:2:{i:0;b:0;s:8:\"auto_add\";a:0:{}}'; // wrong
You have to use either
$v = "a:2:{i:0;b:0;s:8:\"auto_add\";a:0:{}}"; // ok
or
$v = 'a:2:{i:0;b:0;s:8:"auto_add";a:0:{}}'; // ok
By the way, you should never manually unserialize values in WordPress database.
When you need to get an option (or a metadata, or anything that may be serialized) use WP functions: they unserialize the value when needed.
E.g. for options, use get_option
.
If you are interested in how WordPress do unserialization see maybe_unserialize
and is_serialized
.
Related Posts:
- Will it break my site if I delete all transient records in wp_options table?
- Please explain how WordPress works with MySQL character set and collation at a low level
- What is the purpose of the option name hack_file in the options table?
- delete_option() and update_option() returning false
- How to change option recently_edited?
- store simple data in get_option()
- WP_Options ID high
- Transient RSS feeds in wp_options not removed automatically?
- Long option names fail silently?
- save new data to wp_options non-post form
- Huge wp_options table
- WordPress DB: options-table –> 32 gzipcompression?
- wp_options table has duplicate rows and primary key / autoincrement has been removed
- Help running a MySQL query to update all wp_#_options tables in a Multisite install
- What ALL can cause “Another update is currently in progress.”? [closed]
- Should I remove transients from the wp_options table?
- I don’t see site_url and home_url fields in wp_options table (phpMyAdmin)?
- Accidentally deleted active_plugins portion of the wp_options DB table
- batch UPDATE autoload value in wp_options table
- Multiple wp_options tables to share content across installs
- Is there an atomic way to update_option in WordPress (to ensure data integrity)?
- Does auto_load to ‘no’ in wp_options improve performance
- Check if an option exists and get its value in one hit
- My options table is huge. What can I do?
- Change options table prefix only
- When to use custom DB tables or add_option?
- In which format the data is stored in WordPress Databases?
- Automate WordPress website setup with prefilled data
- Image link issues after importing a database backup to my local web server
- Native timestamp on wp_options option
- Whats the best practise on how to store json data from a custom settings page?
- WordPress Settings API Overrides My Previous Value
- What structure and database storage method should I use for temporary storage that may be written concurrently?
- get_option() does unserialize and don’t remove \
- I cannot change anything in my wordpress database from within wordpress?
- Wrong url for the images while using same database for two WordPress installations
- Options table – where does my values go?
- Theme options not being sent to Database
- Multiple Address In WP-Option Value
- How do I use update_option to give me a new option name each time a form is submitted? [duplicate]
- Checking if Database Table exists
- Update Option Stored in Multi-Dimensional Array
- How To Export/Import WordPress (MySQL) Database Properly Via Command-Line?
- Is it possible to define two databases for one installation?
- Syncing local content with development / staging sites
- Export WP database for import using WP-CLI on Vagrant Box
- Improve or optimize a very slow query
- What is the advantage of separating wp_users and wp_usermeta table?
- “MySQL server has gone away” since update to 3.8
- WordPress page title repeated in SOME pages
- Is $wpdb->prepare escaping to much? How to use it properly?
- What is the purpose of storing `siteurl` in database?
- How to log database changes during an upgrade?
- Automate dir and DB stack creation with WP-CLI
- Moving WP from local server to live, error establishing a db connection
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- Exporting table to csv works in the admin but exports HTML data when used on the front end
- wp search-replace (not executing)
- How to remove traces from widget during uninstallation
- Create table from array with prepare
- Migrate database between 2 different wordpress version
- SSO system between 2 WordPress installs on different servers
- Form that sends data to an admin panel and can export it
- is $wpdb->get_results() safe enough
- Convert user passwords to MD5?
- Does post_meta data need to be unserialzed?
- Can’t update WordFence Options, clear data manually
- How to backup my site and restore my wordpress site
- How to fetch records from database WordPress
- AJAX wp-mysql running too slow
- Delete/Replace words from X to Y in post content
- How get Data form wordpress database as array not stdclass?
- cannot connect database
- Multiple WordPress sites installs sharing the same database but with different content and domains
- Brandoo WordPress Unable to Update to WordPress 4.2.2
- Remote database -> massive response time increase?
- Custom Post Type not showing anything added by code anymore?
- How do I have a user upload a blog post and then retrieve that to display in a card on the site?
- Delete user with only subscriber role
- How to rename custom table name programatically in wordpress?
- How to edit custom table data in frontend
- pre_get_posts causings DB error when using ( ‘posts_per_page’, -1)?
- generate PDF from member information
- mysqli_query(): MySQL server has gone away for Curl Request
- Help posting values to DB on submit using $wpdb->query
- WP website showing blank page after moving from subdomain to main domain
- create a table using user meta custom data
- wpdb query to insert images in to post/page gallery
- Creating a database in my plugin not working
- How to create index (sql) to a meta_key?
- WPCLI search and replace in a particlar site dir effect another site-dir
- get_user_meta and umeta_id
- Send data to database after redirect (and popping out of iframe)
- Simple email input store in database
- Pulling values from a sepcific row in table
- import (migration) user database to wp-users
- What is best for saving lot of extra detail of user?
- Insert Extra fields added in the front end registration form to DB
- $wpdb->insert not working for last select option
- How to create a table [closed]