How much string content can I store in an option?

Look at the table schema in wp-admin/includes/schema.php: // regular blog tables CREATE TABLE $wpdb->options ( option_id bigint(20) unsigned NOT NULL auto_increment, option_name varchar(64) NOT NULL default ”, option_value longtext NOT NULL, autoload varchar(20) NOT NULL default ‘yes’, PRIMARY KEY (option_id), UNIQUE KEY option_name (option_name) ) $charset_collate; // Multisite options CREATE TABLE $wpdb->sitemeta ( meta_id bigint(20) … Read more

Add_settings_field() parameterizing callback?

The last optional $args argument the you can pass to add_settings_fields() is passed to callback. So it seems you can use same callback just fine. Hope I am right because I just stumbled onto this two minutes ago because of discussion in chat. 🙂 PS looked through code and it’s indeed relatively recent, before ~2.9 … Read more

WP_Options ID high

I had a similar issue on another site recently, memory usage was through the roof. When I checked the db, wp_options was about 80megabytes. Running this SQL reduced the entire db to 15mb: DELETE FROM `wp_options` WHERE `option_name` LIKE ‘%_transient_%’ Obviously, replace wp_ with your table prefix.

register_setting() vs add_option()

So do I still need to hook admin_init and call those register_setting() if I did add_option() before? Yes. You need. You may add add_option to set the default value. Another call to add_option will do nothing. However, the idea of register_setting() is more than just add_option(). Each setting has the context page such as (general, … Read more

store simple data in get_option()

To recap the comment chain above: I think that’s a perfectly valid way of storing some options in the database, however, it’s good practice to prepend your option name with some unique characters pertaining to your site or something, like ‘my_simple_links’ to avoid possible collisions with other plugins and themes that add_options. Also, if you’re … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)