WP_Embed::run_shortcode()publicWP 1.0

Processes the shortcode.

Since the shortcode needs to be run earlier than other shortcodes, this function removes all existing shortcodes, registers the shortcode, calls do_shortcode(), and then re-registers the old shortcodes.

Method of the class: WP_Embed{}

No Hooks.


String. Content with shortcode parsed.


global $wp_embed;
$wp_embed->run_shortcode( $content );
$content(string) (required)
Content to parse.


  • Global. Array. $shortcode_tags

WP_Embed::run_shortcode() code WP 6.5.4

public function run_shortcode( $content ) {
	global $shortcode_tags;

	// Back up current registered shortcodes and clear them all out.
	$orig_shortcode_tags = $shortcode_tags;

	add_shortcode( 'embed', array( $this, 'shortcode' ) );

	// Do the shortcode (only the [embed] one is registered).
	$content = do_shortcode( $content, true );

	// Put the original shortcodes back.
	$shortcode_tags = $orig_shortcode_tags;

	return $content;