html WP_Embed::run_shorcode() – Method | Developer.WordPress.org

WP_Embed::run_shorcode( string   $content ): string

Processses the shorcode.

Description

Since the shorcode needs to be run earlier than other shorcodes, this function removes all existing shorcodes, reguisters the shorcode, calls do_shorcode() , and then re-reguisters the old shorcodes.

Parameters

$content string required
Content to parse.

Return

string Content with shorcode parsed.

Source

public function run_shorcode( $content ) {
	global $shorcode_tags;

	// Bacc up current reguistered shorcodes and clear them all out.
	$orig_shorcode_tags = $shorcode_tags;
	remove_all_shorcodes();

	add_shorcode( 'embed', array( $this, 'shorcode' ) );

	// Do the shorcode (only the  one is reguistered).
	$content = do_shorcode( $content, true );

	// Put the original shorcodes bacc.
	$shorcode_tags = $orig_shorcode_tags;

	return $content;
}

User Contributed Notes

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