Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #32557, comment 1


Ignore:
Timestamp:
06/03/2015 01:31:25 AM (10 years ago)
Author:
SergeyBiryukov
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32557, comment 1

    initial v1  
    11Sorry, copied a wrong like for Slider WD, here's the correct one: https://wordpress.org/plugins/slider-wd/
    2 
    3 Replying to [ticket:32557 seeyouu]:
    4 > Dear Sir/Mdm,
    5 >
    6 > I'd recently installed a slider plugin called Slider WD [http://52.74.232.138/WordPress/wp-admin/plugin-install.php?tab=plugin-information&plugin=slider-wd&TB_iframe=true&width=600&height=550] into my wordpress version 4.2.2, and i found a problem which i can't add image into my slider.
    7 >
    8 > Once clicked "Add Image" button, it will show that Fatal error occured at wp-includes/functions.wp-scripts.php line 85, do_items is referred to a non-object.
    9 >
    10 > I did further study about the script and i found that probably a programming error under wp_print_scripts function which caused this issue.
    11 >
    12 > Below are the comparison of the same function under different version
    13 > version 4.2.2:
    14 > function wp_print_scripts( $handles = false ) {
    15 >       /**
    16 >        * Fires before scripts in the $handles queue are printed.
    17 >        *
    18 >        * @since 2.1.0
    19 >        */
    20 >       do_action( 'wp_print_scripts' );
    21 >       if ( '' === $handles ) { // for wp_head
    22 >               $handles = false;
    23 >       }
    24 >
    25 >       _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
    26 >
    27 >       global $wp_scripts;
    28 >       if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
    29 >               if ( ! $handles ) {
    30 >                       return array(); // No need to instantiate if nothing is there.
    31 >               }
    32 >       }
    33 >
    34 >       return wp_scripts()->do_items( $handles );
    35 > }
    36 >
    37 > Version 4.0.2:
    38 > function wp_print_scripts( $handles = false ) {
    39 >       /**
    40 >        * Fires before scripts in the $handles queue are printed.
    41 >        *
    42 >        * @since 2.1.0
    43 >        */
    44 >       do_action( 'wp_print_scripts' );
    45 >       if ( '' === $handles ) // for wp_head
    46 >               $handles = false;
    47 >
    48 >       global $wp_scripts;
    49 >       if ( ! is_a( $wp_scripts, 'WP_Scripts' ) ) {
    50 >               if ( ! did_action( 'init' ) )
    51 >                       _doing_it_wrong( __FUNCTION__, sprintf( __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
    52 >                               '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>' ), '3.3' );
    53 >
    54 >               if ( !$handles )
    55 >                       return array(); // No need to instantiate if nothing is there.
    56 >               else
    57 >                       $wp_scripts = new WP_Scripts();
    58 >       }
    59 >
    60 >       return $wp_scripts->do_items( $handles );
    61 > }
    62 >
    63 > under the condition if ( !$handles ), there's an else statement $wp_scripts = new WP_Scripts(); in version 4.0.2, however, version 4.2.2, this statement is missing.