WP_Embed::run_shortcode( string $content ): string

Processes the [embed] 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.

Top ↑


$content string Required
Content to parse.

Top ↑


string Content with shortcode parsed.

Top ↑


File: wp-includes/class-wp-embed.php. View all references

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;

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.