get_theme_mods()
Retrieve all theme modifications.
Uses: get_option()
1 time — 0.001737 sec (very slow) | 50000 times — 2.25 sec (fast) | PHP 7.0.32, WP 5.0.3
No Hooks.
Return
Array
. Theme modifications.
Usage
get_theme_mods();
Examples
#1 Get all the settings
This example shows how to get all the theme mods (options) as an array.
$mods = get_theme_mods(); print_r( $mods ); /* Array ( [0] => [nav_menu_locations] => Array [header] => 2 [footer_credit] => 3 [footer_left] => 4 [footer_right] => 5 [custom_css_post_id] => -1 [custom_logo] => 7 [sidebars_widgets] => Array [time] => 1550171673 [data] => Array [wp_inactive_widgets] => Array [0] => search-2 [1] => recent-posts-2 [2] => recent-comments-2 [3] => archives-2 [4] => categories-2 [5] => meta-2 [footer_bg_image] => http://dh5.com/content/uploads/2019/02/bg-footer.jpg ) */ echo $mods['header_textcolor']; // > 333
Changelog
Since 3.1.0 | Introduced. |
Since 5.9.0 | The return value is always an array. |