apply_shortcodes( string $content, bool $ignore_html = false ): string

Searches content for shortcodes and filter shortcodes through their hooks.

Description

This function is an alias for do_shortcode() .

See also

Parameters

$contentstringrequired
Content to search for shortcodes.
$ignore_htmlbooloptional
When true, shortcodes inside HTML elements will be skipped.

Default:false

Return

string Content with shortcodes filtered out.

Source

function apply_shortcodes( $content, $ignore_html = false ) {
	return do_shortcode( $content, $ignore_html );
}

Changelog

VersionDescription
5.4.0Introduced.

User Contributed Notes

  1. Skip to note 4 content

    Old method –

    echo do_shortcode( '[wpdocs_my_shrtcode text="My Text"]', false );
    echo do_shortcode( '[wpdocs_my_shrtcode]My Text[/wpdocs_my_shrtcode]', false );

    WordPress 5.4 Introduces apply_shortcodes()

    echo apply_shortcodes( '[wpdocs_my_shrtcode text="My Text"]', false );
    echo apply_shortcodes( '[wpdocs_my_shrtcode]My Text[/wpdocs_my_shrtcode]', false );

    // Displays the result of the shortcode

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