When to use custom DB tables or add_option?

For the record, I will never encourage developers to use custom database tables. Yes, they’re easy to use, but you lose 100% of the data abstraction provided by WordPress. add_option()/update_option()/get_option() are basic key-value functions. They store data in a MySQL LONGTEXT field. LONGTEXT can store over 4 million characters … so a 10000+ character option … Read more

Filtering a Database Query

The table wp_options can normally be queried using get_option() So you can use something like $testimonial_settings = get_option(‘testimonial_settings’); to retrieve the values of testimonial_settings. If the stored value is serialized, it will be retrieved as an array.

Is there any other place – besides a theme, a plugin, or a mu-plugin – that an option page might conceivably be used?

Unless you are working on WordPress core development you should not be writing anything but a: Theme Child Theme Plugin Mu-Plugin Drop-In For the last two see: http://hakre.wordpress.com/2010/05/01/must-use-and-drop-ins-plugins/ I am out on a limb a little bit here but I think that is the exhaustive list, with the first three by far the most common.

meta fields for the whole wordpress site

You are talking about “Options”. These are saved in the *_options table and can be stored and retrieved using a number of Core functions (straight from the Codex page above): Add/Delete Option add_option() delete_option() add_site_option() delete_site_option() Get/Update Option get_option() update_option() get_site_option() update_site_option()

update a value in wordpress wp_options

What you are looking at is serialized data– possibly multiple bits of serialized data as @Rarst noted. The Options API will serialize and unserialize automatically so all you need to do is: $data = get_option(‘optionkey’); // $data will be unserialized into whatever data type it was originally, object, array, etc // manipulate your data with … Read more

Add Custom Script in Other Plugin’s Options page

There are several ways to add scripts only to certain admin pages. The best option, from my point of view, is to hook into admin_enqueue_scripts and use the $hook parameter: add_action(‘admin_enqueue_scripts’, ‘cyb_admin_scripts’); function cyb_admin_scripts( $hook ) { //You may need adjustment here to match for page //If the URL of your page is admin.php?page=psbg, the … Read more

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