WordPress.org

Make WordPress Core

Changeset 47004


Ignore:
Timestamp:
12/21/2019 08:10:25 PM (11 months ago)
Author:
SergeyBiryukov
Message:

Shortcodes: Introduce apply_shortcodes() as an alias for do_shortcode().

This better aligns with the semantics of applying filters to the input and returning a result, rather than performing an action and outputting to the current buffer.

Props ljasinskipl, thefarlilacfield.
Fixes #37422.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/shortcodes.php

    r46688 r47004  
    163163 * Search content for shortcodes and filter shortcodes through their hooks.
    164164 *
     165 * This function is an alias for do_shortcode().
     166 *
     167 * @since 5.4.0
     168 *
     169 * @see do_shortcode()
     170 *
     171 * @param string $content     Content to search for shortcodes.
     172 * @param bool   $ignore_html When true, shortcodes inside HTML elements will be skipped.
     173 *                            Default false.
     174 * @return string Content with shortcodes filtered out.
     175 */
     176function apply_shortcodes( $content, $ignore_html = false ) {
     177    return do_shortcode( $content, $ignore_html );
     178}
     179
     180/**
     181 * Search content for shortcodes and filter shortcodes through their hooks.
     182 *
    165183 * If there are no shortcode tags defined, then the content will be returned
    166184 * without any filtering. This might cause issues when plugins are disabled but
     
    171189 * @global array $shortcode_tags List of shortcode tags and their callback hooks.
    172190 *
    173  * @param string $content Content to search for shortcodes.
    174  * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
     191 * @param string $content     Content to search for shortcodes.
     192 * @param bool   $ignore_html When true, shortcodes inside HTML elements will be skipped.
     193 *                            Default false.
    175194 * @return string Content with shortcodes filtered out.
    176195 */
Note: See TracChangeset for help on using the changeset viewer.