[wp-trac] [WordPress Trac] #60519: Link widget always displays rating

WordPress Trac noreply at wordpress.org
Tue Feb 13 02:19:47 UTC 2024


#60519: Link widget always displays rating
--------------------------+-----------------------------
 Reporter:  xurxodiz      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  6.4.3
 Severity:  minor         |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 Using the latest WP version, when you add links through the Link Manager
 and use a Widget to display them in e.g. a sidebar, the links always show
 the rating regardless of the widget setting "Show rating" being unchecked.

 You can test it simply by creating a link, adding it to a link widget and
 placing it in a widget area.

 I've traced the problem to a gap in logic in the 'update' function of /wp-
 includes/widgets/class-wp-widget-links.php

 'rating' setting is not taken care of when updating the instance settings,
 so it is always set to 1 as default during $instance array update. It can
 be fixed by adding the following line after line 114:

 {{{#!php
 $instance['rating']   = ! empty( $new_instance['rating'] ) ? (int)
 $new_instance['rating'] : 0;
 }}}


 Same as it is done in line 114 for 'limit' setting.

 Thanks.

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


More information about the wp-trac mailing list