wp_load_alloptions()
Loads and caches all autoloaded options, if available or all options.
Uses: wp_cache_get(), wp_cache_add()
1 time — 0.003439 sec (very slow) | 50000 times — 0.05 sec (speed of light) | PHP 7.0.32, WP 5.1.1
Hooks from the function
Return
Array
. List of all options.
Usage
wp_load_alloptions( $force_cache );
- $force_cache(true|false)
- Whether to force an update of the local cache from the persistent cache.
Default: false
Examples
#1 Get all the site options
$alloptions = wp_load_alloptions();
As a result $alloptions will contain such an array:
Array ( [siteurl] => http://wp-kama.com/ [blogname] => WordPress as in the palm of your hand [blogdescription] => Features, hacks, and articles for beginners [users_can_register] => 1 [admin_email] => [email protected] [start_of_week] => 1 [use_balanceTags] => [require_name_email] => 1 [comments_notify] => [posts_per_rss] => 15 [rss_use_excerpt] => 1 [default_category] => 1 [default_comment_status] => open [default_ping_status] => open ...
#2 Get all transient options without timelimit
$all_options = wp_load_alloptions(); $all_transients = array(); foreach ( $all_options as $name => $value ) { if ( strstr( $name, '_transient' ) ) { $all_transients[ $name ] = $value; } } print_r( $all_transients );
Notes
- Global. wpdb. $wpdb WordPress database abstraction object.
Changelog
Since 2.2.0 | Introduced. |
Since 5.3.1 | The $force_cache parameter was added. |