wp_ajax_parse_embed()
- Since
- 4.0.0
- Source
wp-admin/includes/ajax-actions.php:3746
Compatibility
- WordPress
- since 4.0.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_ajax_parse_embed() 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
- Heavy
- Scaling
- Scales with input
- Instructions
- 82–173
- Plugin surface
- None
- Called by
- 0
Reaches the database via get_post().
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 229.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- querycontent query
get_post()called directly - hookthird-party callbacks
apply_filters()one call below wp_ajax_parse_embed()
Further down the call graph this can also reach option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 72 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_ajax_parse_embed() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && !$parsed | 82–101 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && !$parsed | 87–102 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && !$parsed | 87–106 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) | 92–109 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && !$parsed | 92–107 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && $parsed | 94–116 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) | 97–114 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && $parsed | 99–117 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && $parsed | 99–121 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && !$parsed | 99–118 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && !$parsed | 101–123 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) && $parsed | 104–124 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
60 further outcomes, up to 173 instructions
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && $parsed | 104–122 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && !$parsed | 104–119 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && !$parsed | 104–123 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && !$parsed | 106–124 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && !$parsed | 106–128 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && !$parsed | 106–128 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) && $parsed | 109–129 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) | 109–126 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && !$parsed | 109–124 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && $parsed | 111–133 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) | 111–131 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && !$parsed | 111–129 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && !$parsed | 111–129 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && !$parsed | 111–133 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && $parsed | 113–138 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) | 114–131 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && $parsed | 116–134 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && empty($no_ssl_support) && $parsed | 116–138 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) | 116–136 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) | 116–136 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && !$parsed | 116–134 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && $parsed | 118–139 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && $parsed | 118–143 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && $parsed | 118–143 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && !$parsed | 118–140 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) && $parsed | 121–141 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !has_shortcode() && !empty($no_ssl_support) && $parsed | 121–139 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) | 121–141 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) && $parsed | 123–146 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && $parsed | 123–144 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && $parsed | 123–144 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && $parsed | 123–148 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && !$parsed | 123–141 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && !$parsed | 123–145 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && !$parsed | 123–145 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !has_shortcode() && empty($no_ssl_support) && $parsed | 126–146 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) && $parsed | 128–151 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) && $parsed | 128–151 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && $parsed | 128–149 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) | 128–148 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && !$parsed | 128–146 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && !$parsed | 128–146 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && !$parsed | 128–150 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && $parsed | 130–155 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) && $parsed | 133–156 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) | 133–153 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) | 133–153 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && !$parsed | 133–151 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && $parsed | 135–156 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && $parsed | 135–160 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && empty($no_ssl_support) && $parsed | 135–160 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) | 138–158 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) && $parsed | 140–163 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && $parsed | 140–161 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && has_shortcode() && !empty($no_ssl_support) && $parsed | 140–161 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && empty($no_ssl_support) && $parsed | 140–165 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) && $parsed | 145–168 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && has_shortcode() && empty($no_ssl_support) && $parsed | 145–168 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && !is_ssl() && !empty($no_ssl_support) && $parsed | 145–166 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), __(), not-ssl(), includes_url(), wp_send_json_success() |
!empty($value) && !isset($value) && !$post_id && current_user_can() && empty($matches) && empty($atts) && $post_id !== 0 && empty($no_ssl_support) && $parsed | 150–173 | current_user_can(), wp_unslash(), get_shortcode_regex(), preg_match(), shortcode_parse_atts(), is_ssl(), ->run_shortcode(), __(), esc_html(), sprintf(), not-embeddable(), has_shortcode(), has_shortcode(), wpview_media_sandbox_styles(), do_shortcode(), ob_start(), wp_print_scripts(), ob_get_clean(), is_ssl(), __(), not-ssl(), includes_url(), 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 | 229 | 82–173 | 31 | |
| 8.5 | 229 | 82–173 | 31 | |
| 8.4 | 229 | 82–173 | 31 | 22 fewer instructions than PHP 8.3 |
| 8.3 | 251 | 85–187 | 31 | |
| 8.2 | 251 | 85–187 | 31 | |
| 8.1 | 251 | 85–187 | 31 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 252 | 85–187 | 31 |
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.
Uses · 18
- wp_send_json_error()Sends a JSON response back to an Ajax request, indicating failure.
- get_post()Retrieves post data given a post ID or post object.
- current_user_can()Returns whether the current user has the specified capability.
- setup_postdata()Set up global post data.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- get_shortcode_regex()Retrieves the shortcode regular expression for searching.
- shortcode_parse_atts()Retrieves all attributes from the shortcodes tag.
- is_ssl()Determines if SSL is used.
- str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
- __()Retrieves the translation of $text.
- esc_html()Escaping for HTML blocks.
- has_shortcode()Determines whether the passed content contains the specified shortcode.
Show all 18
- wpview_media_sandbox_styles()Returns the URLs for CSS files used in an iframe-sandbox'd TinyMCE media view.
- do_shortcode()Searches content for shortcodes and filter shortcodes through their hooks.
- wp_print_scripts()Prints scripts in document head that are in the $handles queue.
- str_contains()Polyfill for `str_contains()` function added in PHP 8.0.
- includes_url()Retrieves the URL to the includes directory.
- wp_send_json_success()Sends a JSON response back to an Ajax request, indicating success.
Source code
function wp_ajax_parse_embed() { global $post, $wp_embed, $content_width; if ( empty( $_POST['shortcode'] ) ) { wp_send_json_error(); } $post_id = isset( $_POST['post_ID'] ) ? (int) $_POST['post_ID'] : 0; if ( $post_id > 0 ) { $post = get_post( $post_id ); if ( ! $post || ! current_user_can( 'edit_post', $post->ID ) ) { wp_send_json_error(); } setup_postdata( $post ); } elseif ( ! current_user_can( 'edit_posts' ) ) { // See WP_oEmbed_Controller::get_proxy_item_permissions_check(). wp_send_json_error(); } $shortcode = wp_unslash( $_POST['shortcode'] ); preg_match( '/' . get_shortcode_regex() . '/s', $shortcode, $matches ); $atts = shortcode_parse_atts( $matches[3] ); if ( ! empty( $matches[5] ) ) { $url = $matches[5]; } elseif ( ! empty( $atts['src'] ) ) { $url = $atts['src']; } else { $url = ''; } $parsed = false; $wp_embed->return_false_on_fail = true; if ( 0 === $post_id ) { /* * Refresh oEmbeds cached outside of posts that are past their TTL. * Posts are excluded because they have separate logic for refreshing * their post meta caches. See WP_Embed::cache_oembed(). */ $wp_embed->usecache = false; } if ( is_ssl() && str_starts_with( $url, 'http://' ) ) { /* * Admin is ssl and the user pasted non-ssl URL. * Check if the provider supports ssl embeds and use that for the preview. */ $ssl_shortcode = preg_replace( '%^(\\[embed[^\\]]*\\])http://%i', '$1https://', $shortcode ); $parsed = $wp_embed->run_shortcode( $ssl_shortcode ); if ( ! $parsed ) { $no_ssl_support = true; } } // Set $content_width so any embeds fit in the destination iframe. if ( isset( $_POST['maxwidth'] ) && is_numeric( $_POST['maxwidth'] ) && $_POST['maxwidth'] > 0 ) { if ( ! isset( $content_width ) ) { $content_width = (int) $_POST['maxwidth']; } else { $content_width = min( $content_width, (int) $_POST['maxwidth'] ); } } if ( $url && ! $parsed ) { $parsed = $wp_embed->run_shortcode( $shortcode ); } if ( ! $parsed ) { wp_send_json_error( array( 'type' => 'not-embeddable', /* translators: %s: URL that could not be embedded. */ 'message' => sprintf( __( '%s failed to embed.' ), '<code>' . esc_html( $url ) . '</code>' ), ) ); }Changelog
Introduced in 4.0.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.8.8 tag, from
src/wp-admin/includes/ajax-actions.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.