[wp-trac] [WordPress Trac] #53452: [WP 5.8 beta 2] $_POST['sidebar'] is missing when saving a widget

WordPress Trac noreply at wordpress.org
Fri Jun 18 19:18:26 UTC 2021


#53452: [WP 5.8 beta 2] $_POST['sidebar'] is missing when saving a widget
--------------------------------------+-----------------------------
 Reporter:  strategio                 |      Owner:  (none)
     Type:  defect (bug)              |     Status:  new
 Priority:  normal                    |  Milestone:  Awaiting Review
Component:  Widgets                   |    Version:  trunk
 Severity:  critical                  |   Keywords:
  Focuses:  administration, rest-api  |
--------------------------------------+-----------------------------
 It's a backward compatibility requirement because this data is available
 in the `$_POST` superglobal when running WP 5.7.2 and it can be used
 inside `\WP_Widget::update`.

 Here's a simple example:


 {{{#!php
 <?php
 class My_Widget extends WP_Widget {

     public function update( $new_instance, $old_instance ) {
         $new_instance['sidebar'] = $_POST['sidebar'];

         return $new_instance;
     }
 }
 }}}

 I can see in `\WP_REST_Widgets_Controller::save_widget` that the `$_POST`
 superglobal is temporarily altered, so I assume we should be able to also
 include the 'sidebar'.

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


More information about the wp-trac mailing list