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:
Jb Audras
2022-09-20 10:29:55 +00:00
parent 1b3b794265
commit 270629df0e
7 changed files with 37 additions and 37 deletions

View File

@@ -52,7 +52,7 @@ class WP_Embed {
*
* Since the [embed] shortcode needs to be run earlier than other shortcodes,
* this function removes all existing shortcodes, registers the [embed] shortcode,
* calls do_shortcode(), and then re-registers the old shortcodes.
* calls apply_shortcodes(), and then re-registers the old shortcodes.
*
* @global array $shortcode_tags
*
@@ -69,7 +69,7 @@ class WP_Embed {
add_shortcode( 'embed', array( $this, 'shortcode' ) );
// Do the shortcode (only the [embed] one is registered).
$content = do_shortcode( $content, true );
$content = apply_shortcodes( $content, true );
// Put the original shortcodes back.
$shortcode_tags = $orig_shortcode_tags;
@@ -177,7 +177,7 @@ class WP_Embed {
}
/**
* The do_shortcode() callback function.
* The apply_shortcodes() callback function.
*
* Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of
* the registered embed handlers. If none of the regex matches and it's enabled, then the URL