shortcode_unautop example

global $wp_embed;

    if ( ! $_wp_current_template_content ) {
        if ( is_user_logged_in() ) {
            return '<h1>' . esc_html__( 'No matching template found' ) . '</h1>';
        }
        return;
    }

    $content = $wp_embed->run_shortcode( $_wp_current_template_content );
    $content = $wp_embed->autoembed( $content );
    $content = shortcode_unautop( $content );
    $content = do_shortcode( $content );
    $content = do_blocks( $content );
    $content = wptexturize( $content );
    $content = convert_smilies( $content );
    $content = wp_filter_content_tags( $content, 'template' );
    $content = str_replace( ']]>', ']]&gt;', $content );

    // Wrap block template in .wp-site-blocks to allow for specific descendant styles     // (e.g. `.wp-site-blocks > *`).     return '<div class="wp-site-blocks">' . $content . '</div>';
}

/* * Manually do shortcodes on the content when the core-added filter is present. It is added by default * in core by adding do_shortcode() to the 'widget_text_content' filter to apply after wpautop(). * Since the legacy Text widget runs wpautop() after 'widget_text' filters are applied, the widget in * legacy mode here manually applies do_shortcode() on the content unless the default * core filter for 'widget_text_content' has been removed, or if do_shortcode() has already * been applied via a plugin adding do_shortcode() to 'widget_text' filters. */
            if ( has_filter( 'widget_text_content', 'do_shortcode' ) && ! $widget_text_do_shortcode_priority ) {
                if ( ! empty( $instance['filter'] ) ) {
                    $text = shortcode_unautop( $text );
                }
                $text = do_shortcode( $text );
            }
        }

        // Restore post global.         $post = $original_post;
        remove_filter( 'shortcode_atts_gallery', array( $this, '_filter_gallery_shortcode_attrs' ) );

        // Undo suspension of legacy plugin-supplied shortcode handling.         if ( $should_suspend_legacy_shortcode_support ) {
            
$area_definition = $defined_area;
            break;
        }
    }

    // If $area is not allowed, set it back to the uncategorized default.     if ( ! $area_definition ) {
        $area = WP_TEMPLATE_PART_AREA_UNCATEGORIZED;
    }

    // Run through the actions that are typically taken on the_content.     $content                       = shortcode_unautop( $content );
    $content                       = do_shortcode( $content );
    $seen_ids[ $template_part_id ] = true;
    $content                       = do_blocks( $content );
    unset( $seen_ids[ $template_part_id ] );
    $content = wptexturize( $content );
    $content = convert_smilies( $content );
    $content = wp_filter_content_tags( $content, "template_part_{$area});

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

    
Home | Imprint | This part of the site doesn't use cookies.