wppaste
WordPress

wp_ajax_parse_embed()

Since
4.0.0
Source
wp-admin/includes/ajax-actions.php:3746
Applies [embed] Ajax handlers to a string.

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

Reaches the database via get_post().

Scaling
Scales with input

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

Instructions
82–173

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

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

What it touches

  • querycontent queryget_post()called directly
  • hookthird-party callbacksapply_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.

WhenInstructionsCalls 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) && !$parsed82–101current_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) && !$parsed87–102current_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) && !$parsed87–106current_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–109current_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) && !$parsed92–107current_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) && $parsed94–116current_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–114current_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) && $parsed99–117current_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) && $parsed99–121current_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) && !$parsed99–118current_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) && !$parsed101–123current_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) && $parsed104–124current_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) && $parsed104–122current_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) && !$parsed104–119current_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) && !$parsed104–123current_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) && !$parsed106–124current_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) && !$parsed106–128current_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) && !$parsed106–128current_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) && $parsed109–129current_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–126current_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) && !$parsed109–124current_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) && $parsed111–133current_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–131current_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) && !$parsed111–129current_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) && !$parsed111–129current_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) && !$parsed111–133current_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) && $parsed113–138current_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–131current_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) && $parsed116–134current_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) && $parsed116–138current_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–136current_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–136current_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) && !$parsed116–134current_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) && $parsed118–139current_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) && $parsed118–143current_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) && $parsed118–143current_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) && !$parsed118–140current_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) && $parsed121–141current_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) && $parsed121–139current_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–141current_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) && $parsed123–146current_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) && $parsed123–144current_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) && $parsed123–144current_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) && $parsed123–148current_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) && !$parsed123–141current_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) && !$parsed123–145current_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) && !$parsed123–145current_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) && $parsed126–146current_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) && $parsed128–151current_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) && $parsed128–151current_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) && $parsed128–149current_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–148current_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) && !$parsed128–146current_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) && !$parsed128–146current_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) && !$parsed128–150current_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) && $parsed130–155current_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) && $parsed133–156current_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–153current_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–153current_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) && !$parsed133–151current_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) && $parsed135–156current_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) && $parsed135–160current_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) && $parsed135–160current_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–158current_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) && $parsed140–163current_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) && $parsed140–161current_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) && $parsed140–161current_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) && $parsed140–165current_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) && $parsed145–168current_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) && $parsed145–168current_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) && $parsed145–166current_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) && $parsed150–173current_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

PHPCompiledExecutedBranchesNotes
8.6-dev22982–17331
8.522982–17331
8.422982–1733122 fewer instructions than PHP 8.3
8.325185–18731
8.225185–18731
8.125185–187311 fewer instruction than PHP 7.4
7.425285–18731

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

Show all 18

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.

  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.

About this page

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