How to unserialize data from MySQL

As @Jacob said : To retrieve your option data : $your_data = get_option(‘option_tree’); To save your new data to the option : $new_data = array(…); update_option(‘option_tree’, $new_data);

DB Query not working in Plugin

Looking at the SQL query in $createSQL, ENGINE=InnoDB” . $wpdb->get_charset_collate() . ” AUTO_INCREMENT=1; yields to: Error in query (1286): Unknown storage engine ‘InnoDBDEFAULT’ To fix it, add a space between the ENGINE=InnoDB (the storage engine) and ” . $wpdb->get_charset_collate() (the charset). You have defined the column id as AUTO_INCREMENT, but the column is not a … Read more

How to set MYSQLI_OPT_INT_AND_FLOAT_NATIVE option

That’s why I’m wondering why is WordPress stuck to this pre-PHP-5.3 limitation. Because WordPress has made the decision to support PHP 5.2 due to the large number of hosts that continue to use it. This is an ongoing debate and there’s no point rehashing it all here. But this means that I have to know … Read more

Update query for wp_posts and wp_postmeta

The post_id column in the wp_postmeta table is a reference to the ID column in the wp_posts table. I’d suggest using the native update_post_meta() function in WordPress to update the meta data. E.g. (Post ID is 123 in this example, and we’re updating the price to 100.00): update_post_meta(123, ‘_price’, ‘100.00’); Here is the SQL equivalent: … Read more

how to insert missing tags into the posts through mySQL?

You should not modify the wordpress DB via SQL unless it is a total emergency. WordPress DB structure getting more complex with time and there are always possible intractions with plugins that you might bypass with direct SQL. What you should do is to write a small plugin that inserts the tags by calling using … Read more