Skip to content

Commit

Permalink
Move global $wp_embed and document its usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev committed Oct 7, 2023
1 parent eb54972 commit c1a3f4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/wp-includes/block-template-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,9 +1158,13 @@ function get_block_file_template( $id, $template_type = 'wp_template' ) {
*
* @since 5.9.0
*
* @global WP_Embed $wp_embed An instance of WP_Embed for embedding rich media.
*
* @param string $part The block template part to print. Use "header" or "footer".
*/
function block_template_part( $part ) {
global $wp_embed;

$template_part = get_block_template( get_stylesheet() . '//' . $part, 'wp_template_part' );
if ( ! $template_part || empty( $template_part->content ) ) {
return;
Expand All @@ -1175,7 +1179,6 @@ function block_template_part( $part ) {
$content = do_shortcode( $content );

// Handle embeds for block template parts.
global $wp_embed;
$content = $wp_embed->autoembed( $content );

echo $content;
Expand Down

0 comments on commit c1a3f4d

Please sign in to comment.