Best possible way to get all options
I need to provide a list of all options set via plugins etc to remote calls. There is a plugin WP API Options but it hardly does the job.
There are two possible ways (that I know of) to get a list of all options set in the blog/site:
Use
$wpdb
to run a query like so:$option_names = $wpdb-get_col( "SELECT DISTINCT option_name FROM $wpdb-options WHERE option_name NOT LIKE '_transient_%'" );
Use
wp_load_alloptions()
Which one of these two would be the best way to retrieve all the options? Is there a cleaner way than either of these two?
Edit: In a perfect world, I would like to use an inbuilt function for this, instead of writing MySql queries. Also, by all options I am implying any option set by a plugin using add_option
or update_option
functions.