W3cubDocs

/WordPress

WP_Embed::run_shortcode( string $content )

Process the [embed] shortcode.

Description

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.

Parameters

$content

(string) (Required) Content to parse

Return

(string) Content with shortcode parsed

Source

File: wp-includes/class-wp-embed.php

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

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

		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;
	}

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_embed/run_shortcode