Make WordPress Core

Ticket #31126: add-return-to-wp_register_script.diff

File add-return-to-wp_register_script.diff, 1.0 KB (added by katzwebdesign, 10 years ago)

Have the wp_register_script() function return boolean passed by $wp_scripts->add()

  • wp-includes/functions.wp-scripts.php

     
    106106 *                               If set to null, no version is added. Default 'false'. Accepts 'false', 'null', or 'string'.
    107107 * @param bool        $in_footer Optional. Whether to enqueue the script before </head> or before </body>.
    108108 *                               Default 'false'. Accepts 'false' or 'true'.
     109 * @return bool Whether the script has been registered. True on success, false on failure.
    109110 */
    110111function wp_register_script( $handle, $src, $deps = array(), $ver = false, $in_footer = false ) {
    111112        $wp_scripts = wp_scripts();
    112113        _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
    113114
    114         $wp_scripts->add( $handle, $src, $deps, $ver );
     115        $return = $wp_scripts->add( $handle, $src, $deps, $ver );
    115116        if ( $in_footer ) {
    116117                $wp_scripts->add_data( $handle, 'group', 1 );
    117118        }
     119
     120        return $return;
    118121}
    119122
    120123/**