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

Search content for shortcodes and filter shortcodes through their hooks.

Description Description

This function is an alias for do_shortcode().

Top ↑

See also See also

Top ↑

Parameters Parameters


(string) (Required) Content to search for shortcodes.


(bool) (Optional) When true, shortcodes inside HTML elements will be skipped.

Default value: false

Top ↑

Return Return

(string) Content with shortcodes filtered out.

Top ↑

Source Source

File: wp-includes/shortcodes.php

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 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

Top ↑

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