$all_options = wp_load_alloptions();
$plugin_order_options = array();
foreach( $all_options as $name => $value ) {
if(stristr($name, 'plugin_order_')) $plugin_order_options[$name] = $value;
}
print_r($plugin_order_options);
In plain English:
We load all WP options in
$all_options
. We copy options from$all_options
to$plugin_order_options
if their name containsplugin_order_
. We print$plugin_order_options
. We scratch our head, unhappy with the size of the customized mono-spaced font of our browser. We should have left it default.
As mentioned by @Rarst, wp_autoload_options()
will retrieve all autoload options or all options, if no autoloaded ones exist. So, if the above code doesn’t work for you, you might want to try this one:
$options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );
foreach ( (array) $options as $option ) :
if ( $option->option_name == '' )
continue;
$name = esc_attr( $option->option_name );
if(stristr($name, 'plugin_order_'))
$plugin_order_options[$name] = is_serialized( $option->option_value ) ?
maybe_unserialize( $option->option_value ) :
$option->option_value;
endforeach;
print_r($plugin_order_options);
It basically fetches all entries from wp_options
table, and for those who have plugin_order_
in their name it passes the value to our $plugin_order_options
array. This time I also check if data is serialized and attempt to unserialize it.