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

Search content for shortcodes and filter shortcodes through their hooks.


Description

This function is an alias for do_shortcode() .

Top ↑

See also


Top ↑

Parameters

$content string Required
Content to search for shortcodes.
$ignore_html bool Optional
When true, shortcodes inside HTML elements will be skipped.

Default: false


Top ↑

Return

string Content with shortcodes filtered out.


Top ↑

Source

File: wp-includes/shortcodes.php. View all references

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


Top ↑

Changelog

Changelog
Version Description
5.4.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 2 content
    Contributed by Ataur R

    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.