mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-14 09:34:41 +00:00
Shortcodes: Reverse wrapping of apply_shortcodes() and do_shortcode().
This changeset reverses the wrapping of `apply_shortcodes()` and `do_shortcode()` such that `apply_shortcodes()` is now the recommended function. In addition: - Calls to `do_shortcode()` have been changed to `apply_shortcodes()`. - Some default filter callbacks have been changed from `'do_shortcode'` to `'apply_shortcodes'`. - Applicable documentation has been updated to refer to `apply_shortcodes()` instead. Follow-up to [47004]. Props SergeyBiryukov, rafiahmedd, namithjawahar, peterwilsoncc, costdev. Fixes #55883. git-svn-id: https://develop.svn.wordpress.org/trunk@54248 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* To apply shortcode tags to content:
|
||||
*
|
||||
* $out = do_shortcode( $content );
|
||||
* $out = apply_shortcodes( $content );
|
||||
*
|
||||
* @link https://developer.wordpress.org/plugins/shortcodes/
|
||||
*
|
||||
@@ -168,24 +168,6 @@ function has_shortcode( $content, $tag ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches content for shortcodes and filter shortcodes through their hooks.
|
||||
*
|
||||
* This function is an alias for do_shortcode().
|
||||
*
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @see do_shortcode()
|
||||
*
|
||||
* @param string $content Content to search for shortcodes.
|
||||
* @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
|
||||
* Default false.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function apply_shortcodes( $content, $ignore_html = false ) {
|
||||
return do_shortcode( $content, $ignore_html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches content for shortcodes and filter shortcodes through their hooks.
|
||||
*
|
||||
@@ -193,7 +175,7 @@ function apply_shortcodes( $content, $ignore_html = false ) {
|
||||
* without any filtering. This might cause issues when plugins are disabled but
|
||||
* the shortcode will still show up in the post or content.
|
||||
*
|
||||
* @since 2.5.0
|
||||
* @since 5.4.0
|
||||
*
|
||||
* @global array $shortcode_tags List of shortcode tags and their callback hooks.
|
||||
*
|
||||
@@ -202,7 +184,7 @@ function apply_shortcodes( $content, $ignore_html = false ) {
|
||||
* Default false.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcode( $content, $ignore_html = false ) {
|
||||
function apply_shortcodes( $content, $ignore_html = false ) {
|
||||
global $shortcode_tags;
|
||||
|
||||
if ( false === strpos( $content, '[' ) ) {
|
||||
@@ -232,6 +214,24 @@ function do_shortcode( $content, $ignore_html = false ) {
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches content for shortcodes and filter shortcodes through their hooks.
|
||||
*
|
||||
* This function is an alias for apply_shortcodes().
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
* @see apply_shortcodes()
|
||||
*
|
||||
* @param string $content Content to search for shortcodes.
|
||||
* @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
|
||||
* Default false.
|
||||
* @return string Content with shortcodes filtered out.
|
||||
*/
|
||||
function do_shortcode( $content, $ignore_html = false ) {
|
||||
return apply_shortcodes( $content, $ignore_html );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the shortcode regular expression for searching.
|
||||
*
|
||||
@@ -299,7 +299,7 @@ function get_shortcode_regex( $tagnames = null ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Regular Expression callable for do_shortcode() for calling shortcode hook.
|
||||
* Regular Expression callable for apply_shortcodes() for calling shortcode hook.
|
||||
*
|
||||
* @see get_shortcode_regex() for details of the match array contents.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user