Make WordPress Core


Ignore:
Timestamp:
09/20/2022 10:29:55 AM (2 years ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

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

    r54133 r54248  
    5353     * Since the [embed] shortcode needs to be run earlier than other shortcodes,
    5454     * this function removes all existing shortcodes, registers the [embed] shortcode,
    55      * calls do_shortcode(), and then re-registers the old shortcodes.
     55     * calls apply_shortcodes(), and then re-registers the old shortcodes.
    5656     *
    5757     * @global array $shortcode_tags
     
    7070
    7171        // Do the shortcode (only the [embed] one is registered).
    72         $content = do_shortcode( $content, true );
     72        $content = apply_shortcodes( $content, true );
    7373
    7474        // Put the original shortcodes back.
     
    178178
    179179    /**
    180      * The do_shortcode() callback function.
     180     * The apply_shortcodes() callback function.
    181181     *
    182182     * Attempts to convert a URL into embed HTML. Starts by checking the URL against the regex of
Note: See TracChangeset for help on using the changeset viewer.