How to get data/meta data from the wp_options table in the wordpress .In this table, option_values are(some values) saved as serialized .So directly we can’t get those values.Now I’ll tell you easy method to get this value from wp_options table.
I want to get option name – “feedburnercount/feedburnercount.php”, values.
Values like this.
a:24:{i:0;s:43:”broken-link-checker/broken-link-checker.php”;i:1;s:43:”clean-notifications/clean-notifications.php”;i:2;s:32:”crpostwarning/cr-postwarning.php”;i:3;s:35:”fancybox-for-wordpress/fancybox.php”;i:4;s:35:” feedburnercount/feedburnercount.php”;i:5;s:53:” generate-post-thumbnails/generate-post-thumbnails.php”;}
(I want to get 53)
First get data of the “active_plugins”.
$sql = "SELECT wp_options.option_value FROM wp_options WHERE wp_options.option_name = 'active_plugins' "; $result = mysql_query($sql) or die (mysql_error()); $active_plugins_data =""; while($rows = mysql_fetch_array($result)) { $active_plugins_data .= $rows["option_value"]; }
Now these data must be unserialize.
$array = unserialize($active_plugins_data); echo $array["feedburnercount/feedburnercount.php"];