WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/10/2015 07:56:15 PM (7 years ago)
Author:
johnbillion
Message:

Add a return value to wp_register_script() and wp_register_style() which matches the return value of WP_Dependencies::add().

Props katzwebdesign, pareshradadiya, DrewAPicture.

Fixes #31126

File:
1 edited

Legend:

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

    r32124 r32483  
    9595 *
    9696 * @since 2.6.0
     97 * @since 4.3.0 A return value was added.
    9798 *
    9899 * @param string      $handle    Name of the script. Should be unique.
     
    106107 * @param bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
    107108 *                               Default 'false'. Accepts 'false' or 'true'.
     109 * @return bool Whether the script has been registered. True on success, false on failure.
    108110 */
    109111function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
     
    111113    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
    112114
    113     $wp_scripts->add( $handle, $src, $deps, $ver );
     115    $registered = $wp_scripts->add( $handle, $src, $deps, $ver );
    114116    if ( $in_footer ) {
    115117        $wp_scripts->add_data( $handle, 'group', 1 );
    116118    }
     119
     120    return $registered;
    117121}
    118122
Note: See TracChangeset for help on using the changeset viewer.