[wp-trac] [WordPress Trac] #33471: wp_enqueue_style() doesn't register it in parallel wp_enqueue_scripts

WordPress Trac noreply at wordpress.org
Thu Aug 20 19:58:30 UTC 2015


#33471: wp_enqueue_style() doesn't register it in parallel wp_enqueue_scripts
--------------------------+-----------------------------
 Reporter:  Looimaster    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Possibly a bug:

 https://core.trac.wordpress.org/browser/tags/4.2.2/src/wp-
 includes/functions.wp-scripts.php

 {{{
 function my_scripts2() {

         //global $wp_styles;
         //var_dump($wp_styles);

         var_dump(wp_style_is( 'my-style', 'enqueued' )); // true
         var_dump(wp_style_is( 'my-style', 'registered' )); // false
 (probably wrong)
         var_dump(wp_style_is( 'my-style', 'to_do' )); // false
         var_dump(wp_style_is( 'my-style', 'done' )); // false

         wp_add_inline_style( 'my-style', $some_css ); // This fails
 because of this issue.
 add_action( 'wp_enqueue_scripts', 'my_scripts2' );

 function my_scripts() {

         // Loads our main stylesheet.
         wp_enqueue_style( 'my-style', get_stylesheet_uri() );

         var_dump(wp_style_is( 'my-style', 'enqueued' )); // true
         var_dump(wp_style_is( 'my-style', 'registered' )); // true
         var_dump(wp_style_is( 'my-style', 'to_do' )); // false
         var_dump(wp_style_is( 'my-style', 'done' )); // false
 }
 add_action( 'wp_enqueue_scripts', 'my_scripts' );
 }}}

 If I reverse `add_action(...)` lines then both show true/true/false/false.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33471>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list