Title: apply_shortcodes
Published: April 1, 2020
Last modified: April 28, 2025

---

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

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#wp--skip-link--target)

Searches content for shortcodes and filter shortcodes through their hooks.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#description)󠁿

This function is an alias for [do_shortcode()](https://developer.wordpress.org/reference/functions/do_shortcode/).

### 󠀁[See also](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#see-also)󠁿

 * [do_shortcode()](https://developer.wordpress.org/reference/functions/do_shortcode/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#parameters)󠁿

 `$content`stringrequired

Content to search for shortcodes.

`$ignore_html`booloptional

When true, shortcodes inside HTML elements will be skipped.

Default:`false`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#return)󠁿

 string Content with shortcodes filtered out.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/shortcodes.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/shortcodes.php#L223)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/shortcodes.php#L223-L225)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#related)󠁿

| Uses | Description | 
| [do_shortcode()](https://developer.wordpress.org/reference/functions/do_shortcode/)`wp-includes/shortcodes.php` |

Searches content for shortcodes and filter shortcodes through their hooks.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.4.0](https://developer.wordpress.org/reference/since/5.4.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#comment-content-3872)
 2.    [MakeWebBetter](https://profiles.wordpress.org/makewebbetter/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/apply_shortcodes/#comment-3872)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%23comment-3872)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%23comment-3872)
 4.  Here is the implementation by current method –
 5.      ```php
         echo do_shortcode( '[myshrtcode]My Text[/myshrtcode]' );
         ```
     
 6.  And here is the usage which new WordPress 5.4 Introduces
 7.      ```php
         echo apply_shortcodes( '[myshrtcode]My Text[/myshrtcode]' );
         // Displays the result of the shortcode
         ```
     
 8.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%3Freplytocom%3D3872%23feedback-editor-3872)
 9.   [Skip to note 4 content](https://developer.wordpress.org/reference/functions/apply_shortcodes/?output_format=md#comment-content-4037)
 10.   [Ataur R](https://profiles.wordpress.org/ataurr/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/apply_shortcodes/#comment-4037)
 11. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%23comment-4037)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%23comment-4037)
 12. Old method –
 13.     ```php
         echo do_shortcode( '[wpdocs_my_shrtcode text="My Text"]', false );
         echo do_shortcode( '[wpdocs_my_shrtcode]My Text[/wpdocs_my_shrtcode]', false );
         ```
     
 14. WordPress 5.4 Introduces [apply_shortcodes()](https://developer.wordpress.org/reference/functions/apply_shortcodes/)
 15.     ```php
         echo apply_shortcodes( '[wpdocs_my_shrtcode text="My Text"]', false );
         echo apply_shortcodes( '[wpdocs_my_shrtcode]My Text[/wpdocs_my_shrtcode]', false );
         ```
     
 16. // Displays the result of the shortcode
 17.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F%3Freplytocom%3D4037%23feedback-editor-4037)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fapply_shortcodes%2F)
before being able to contribute a note or feedback.