[wp-trac] [WordPress Trac] #38723: Widget correct number is not displayed into the global $wp_registered_widgets array

WordPress Trac noreply at wordpress.org
Wed Nov 9 01:11:15 UTC 2016


#38723: Widget correct number is not displayed into the global
$wp_registered_widgets array
--------------------------+-----------------------------
 Reporter:  alexvorn2     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 When displaying the array on the page (widget.php)...


 {{{#!php
 <?php
 echo '<pre>';
 print_r( $wp_registered_widgets );
 echo '</pre>';
 }}}


 I get the widget number value incorrect, it is the maximum number of
 widgets of the current widget type.

 '''How to replicate my problem?

 1. Fresh install
 2. Drag 2, 3 or more widgets to a sidebar
 3. paste the this code in the functions.php file of the theme..

 {{{#!php
 <?php
 function show_registered_widgets() {
         global $wp_registered_widgets;

         echo '<pre>';
         print_r( $wp_registered_widgets );
         echo '</pre>';

 } add_action( 'widgets_admin_page', 'show_registered_widgets' );
 }}}


 4. Go to widgets.php page and you will see a big array with all widgets
 Find the widgets you added to the siderbar, and if you look close in the
 that object of the widget array, you can find that the number is
 incorrect.

 Take a look to this screenshot of what you will see...
 http://alexvorn.com/wp-content/uploads/2016/11/why3.png

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


More information about the wp-trac mailing list