WordPress.org

Make WordPress Core

Changeset 41282


Ignore:
Timestamp:
08/20/2017 07:47:20 PM (2 years ago)
Author:
DrewAPicture
Message:

Shortcodes: Rename the $func parameter for add_shortcode() to $callback to improve clarity.

See #37222. See #41017.

File:
1 edited

Legend:

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

    r41281 r41282  
    5454 * @global array $shortcode_tags
    5555 *
    56  * @param string   $tag  Shortcode tag to be searched in post content.
    57  * @param callable $func The callback function to run when the shortcode is found.
    58  *                       Every shortcode callback is passed three parameters by default,
    59  *                       including an array of attributes (`$atts`), the content
    60  *                       the shortcode was found in (`$content`), and finally
    61  *                       the shortcode tag itself (`$shortcode_tag`), in that order.
    62  */
    63 function add_shortcode($tag, $func) {
     56 * @param string   $tag      Shortcode tag to be searched in post content.
     57 * @param callable $callback The callback function to run when the shortcode is found.
     58 *                           Every shortcode callback is passed three parameters by default,
     59 *                           including an array of attributes (`$atts`), the content
     60 *                           the shortcode was found in (`$content`), and finally
     61 *                           the shortcode tag itself (`$shortcode_tag`), in that order.
     62 */
     63function add_shortcode( $tag, $callback ) {
    6464    global $shortcode_tags;
    6565
     
    7777    }
    7878
    79     $shortcode_tags[ $tag ] = $func;
     79    $shortcode_tags[ $tag ] = $callback;
    8080}
    8181
Note: See TracChangeset for help on using the changeset viewer.