WP_Customize_Manager::handle_load_themes_request(): never
- Since
- 4.9.0
- Source
wp-includes/class-wp-customize-manager.php:5836
Compatibility
- WordPress
- since 4.9.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
never
Performance profile
How much work a call to WP_Customize_Manager::handle_load_themes_request() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Scales with input
- Instructions
- 57–152
- Plugin surface
- 1 hook
- Called by
- 0
Reaches an outbound HTTP request via wp_remote_get().
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 315.
Third-party callbacks on 'customize_load_themes' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly - transienttransient
get_site_transient()one call below WP_Customize_Manager::handle_load_themes_request() - optionnetwork option
get_site_option()one call below WP_Customize_Manager::handle_load_themes_request() - httpoutbound HTTP request
wp_remote_get()one call below WP_Customize_Manager::handle_load_themes_request()
Further down the call graph this can also reach cache, query and serialize. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 89 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Customize_Manager::handle_load_themes_request() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 57 | check_ajax_referer(), current_user_can(), sanitize_key(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 61–62 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 62 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 65 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 65 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 66 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 66–67 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 68 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 69–70 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 69 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 70 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 70–71 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
77 further outcomes, up to 152 instructions
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 71 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 72–73 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 73 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 73–74 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 74 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 74–75 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 74 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 75–76 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 77 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 77–78 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 78–79 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 78–79 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 79 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 81–82 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action !== "wporg" | 82 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action === "installed" | 83–84 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action === "installed" | 86–87 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), wp_prepare_themes_for_js(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 115–122 | check_ajax_referer(), current_user_can(), sanitize_key(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 117–124 | check_ajax_referer(), current_user_can(), sanitize_key(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 118–125 | check_ajax_referer(), current_user_can(), sanitize_key(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 120–127 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 120–127 | check_ajax_referer(), current_user_can(), sanitize_key(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 122–129 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 123–130 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 123–130 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 123–130 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 124–131 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 125–132 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 125–132 | check_ajax_referer(), current_user_can(), sanitize_key(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 125–132 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 126–133 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 126–133 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 126–133 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 126–128 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 127–134 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 127–134 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 128–135 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 128–135 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 128–135 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 128–130 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 129–136 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 129–136 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 129–136 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 129–136 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 130–137 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 130–137 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 131–138 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 131–138 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 131–138 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 131–138 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 132–139 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 132–139 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 132–139 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 132–139 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 133–140 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 133–140 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 134–141 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 134–141 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 134–141 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 134–141 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 135–142 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 135–142 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 135–142 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 136–143 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 137–144 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 137–144 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 137–144 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 137–144 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 138–145 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 139–146 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 140–147 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 140–147 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 140–147 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
!empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 142–149 | check_ajax_referer(), current_user_can(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
current_user_can() && empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 142–149 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && !is_wp_error() | 143–150 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
empty($value) && $theme_action !== "installed" && $theme_action === "wporg" && is_wp_error() | 145–152 | check_ajax_referer(), current_user_can(), wp_send_json_error(), sanitize_key(), wp_unslash(), sanitize_text_field(), wp_unslash(), array_map(), absint(), current_user_can(), wp_die(), array_merge(), themes_api(), is_wp_error(), wp_send_json_error(), array_fill_keys(), array_fill_keys(), array_fill_keys(), wp_get_themes(), network_admin_url(), apply_filters(), wp_send_json_success() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 315 | 57–152 | 21 | |
| 8.5 | 315 | 57–152 | 21 | |
| 8.4 | 315 | 57–152 | 21 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 318 | 57–152 | 21 | |
| 8.2 | 318 | 57–152 | 21 | |
| 8.1 | 318 | 57–152 | 21 | |
| 7.4 | 318 | 57–152 | 21 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while WP_Customize_Manager::handle_load_themes_request() runs, in this order:
- apply_filters( customize_load_themes )filterline 5994 (+158 into the body)
Filters the theme data loaded in the customizer.
Uses · 23
- check_ajax_referer()Verifies the Ajax request to prevent processing requests external of the blog.
- current_user_can()Returns whether the current user has the specified capability.
- wp_die()Kills WordPress execution and displays HTML page with an error message.
- wp_send_json_error()Sends a JSON response back to an Ajax request, indicating failure.
- sanitize_key()Sanitizes a string key.
- sanitize_text_field()Sanitizes a string from user input or from the database.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- absint()Converts a value to non-negative integer.
- wp_prepare_themes_for_js()Prepares themes for JavaScript.
- themes_api()Retrieves theme installer pages from the WordPress.org Themes API.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- wp_get_themes()Returns an array of WP_Theme objects based on the arguments.
Show all 23
- network_admin_url()Retrieves the URL to the admin area for the network.
- add_query_arg()Retrieves a modified URL query string.
- wp_create_nonce()Creates a cryptographic token tied to a specific action, user, user session, and window of time.
- wp_kses()Filters text content and strips out disallowed HTML.
- wp_star_rating()Outputs a HTML element with a star rating for a given rating.
- number_format_i18n()Converts float number to format based on the locale.
- set_url_scheme()Sets the scheme for a URL.
- is_wp_version_compatible()Checks compatibility with the current WordPress version.
- is_php_version_compatible()Checks compatibility with the current PHP version.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_send_json_success()Sends a JSON response back to an Ajax request, indicating success.
Source code
public function handle_load_themes_request() { check_ajax_referer( 'switch_themes', 'nonce' ); if ( ! current_user_can( 'switch_themes' ) ) { wp_die( -1 ); } if ( empty( $_POST['theme_action'] ) ) { wp_send_json_error( 'missing_theme_action' ); } $theme_action = sanitize_key( $_POST['theme_action'] ); $themes = array(); $args = array(); // Define query filters based on user input. if ( ! array_key_exists( 'search', $_POST ) ) { $args['search'] = ''; } else { $args['search'] = sanitize_text_field( wp_unslash( $_POST['search'] ) ); } if ( ! array_key_exists( 'tags', $_POST ) ) { $args['tag'] = ''; } else { $args['tag'] = array_map( 'sanitize_text_field', wp_unslash( (array) $_POST['tags'] ) ); } if ( ! array_key_exists( 'page', $_POST ) ) { $args['page'] = 1; } else { $args['page'] = absint( $_POST['page'] ); } require_once ABSPATH . 'wp-admin/includes/theme.php'; if ( 'installed' === $theme_action ) { // Load all installed themes from wp_prepare_themes_for_js(). $themes = array( 'themes' => array() ); foreach ( wp_prepare_themes_for_js() as $theme ) { $theme['type'] = 'installed'; $theme['active'] = ( isset( $_POST['customized_theme'] ) && $_POST['customized_theme'] === $theme['id'] ); $themes['themes'][] = $theme; } } elseif ( 'wporg' === $theme_action ) { // Load WordPress.org themes from the .org API and normalize data to match installed theme objects. if ( ! current_user_can( 'install_themes' ) ) { wp_die( -1 ); } // Arguments for all queries. $wporg_args = array( 'per_page' => 100, 'fields' => array( 'reviews_url' => true, // Explicitly request the reviews URL to be linked from the customizer. ), ); $args = array_merge( $wporg_args, $args ); if ( '' === $args['search'] && '' === $args['tag'] ) { $args['browse'] = 'new'; // Sort by latest themes by default. } // Load themes from the .org API. $themes = themes_api( 'query_themes', $args ); if ( is_wp_error( $themes ) ) { wp_send_json_error(); } // This list matches the allowed tags in wp-admin/includes/theme-install.php. $themes_allowedtags = array_fill_keys( array( 'a', 'abbr', 'acronym', 'code', 'pre', 'em', 'strong', 'div', 'p', 'ul', 'ol', 'li', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img' ), array() ); $themes_allowedtags['a'] = array_fill_keys( array( 'href', 'title', 'target' ), true ); $themes_allowedtags['acronym']['title'] = true; $themes_allowedtags['abbr']['title'] = true; $themes_allowedtags['img'] = array_fill_keys( array( 'src', 'class', 'alt' ), true );Changelog
Introduced in 4.9.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
none to never.verified against sourceAbout this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-customize-manager.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.