wppaste
WordPress

WP_Customize_Manager::handle_load_themes_request()

Since
4.9.0
Source
wp-includes/class-wp-customize-manager.php:5829
Loads themes into the theme browsing/installation UI.

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.

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

Reaches an outbound HTTP request via wp_remote_get().

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
57–152

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 315.

Plugin surface
1 hook

Third-party callbacks on 'customize_load_themes' run inside this call, and their cost is not bounded by anything here.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • transienttransientget_site_transient()one call below WP_Customize_Manager::handle_load_themes_request()
  • optionnetwork optionget_site_option()one call below WP_Customize_Manager::handle_load_themes_request()
  • httpoutbound HTTP requestwp_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.

WhenInstructionsCalls it makes
current_user_can() && !empty($value) && $theme_action !== "installed" && $theme_action !== "wporg"57check_ajax_referer(), current_user_can(), sanitize_key(), apply_filters(), wp_send_json_success()
current_user_can() && !empty($value) && $theme_action === "installed"61–62check_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"62check_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"65check_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"65check_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"66check_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–67check_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"68check_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–70check_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"69check_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"70check_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–71check_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"71check_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–73check_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"73check_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–74check_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"74check_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–75check_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"74check_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–76check_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"77check_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–78check_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–79check_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–79check_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"79check_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–82check_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"82check_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–84check_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–87check_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–122check_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–124check_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–125check_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–127check_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–127check_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–129check_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–130check_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–130check_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–130check_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–131check_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–132check_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–132check_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–132check_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–133check_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–133check_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–133check_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–128check_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–134check_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–134check_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–135check_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–135check_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–135check_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–130check_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–136check_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–136check_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–136check_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–136check_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–137check_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–137check_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–138check_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–138check_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–138check_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–138check_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–139check_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–139check_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–139check_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–139check_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–140check_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–140check_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–141check_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–141check_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–141check_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–141check_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–142check_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–142check_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–142check_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–143check_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–144check_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–144check_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–144check_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–144check_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–145check_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–146check_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–147check_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–147check_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–147check_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–149check_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–149check_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–150check_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–152check_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

PHPCompiledExecutedBranchesNotes
8.6-dev31557–15221
8.531557–15221
8.431557–152213 fewer instructions than PHP 8.3
8.331857–15221
8.231857–15221
8.131857–15221
7.431857–15221

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:

  1. apply_filters( customize_load_themes )filterline 5987 (+158 into the body)

    Filters the theme data loaded in the customizer.

Uses · 23

Show all 23

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

7.1.0
Return type changed from none to never.verified against source
4.9.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 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.