Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#42226 closed defect (bug) (fixed)

Normalise access widget_title in WP_Widget_Media

Reported by: Bsop Owned by: westonruter
Priority: normal Milestone: 4.9
Component: Widgets Version: 4.8
Severity: normal Keywords: has-patch
Cc: Focuses: template

Description

It seems that in most default widgets, the filter widget_title is always available, even if the user did not provide a title. In the abstract class WP_Widget_Media however, this is not the case, the apply_filters function will only be called if a title property exists in $instance. This is of course impractical when one wants to apply a hook callback to all default widget titles.

Attachments (2)

normalise-widget-title.diff (863 bytes ) - added by Bsop 9 years ago.
patch
normalise-widget-title.2.diff (851 bytes ) - added by Bsop 9 years ago.
actually test for filtered title

Download all attachments as: .zip

Change History (5)

@Bsop
9 years ago

patch

@Bsop
9 years ago

actually test for filtered title

#1 @westonruter
9 years ago

  • Keywords has-patch added
  • Milestone Awaiting Review4.9
  • Owner set to westonruter
  • Status newaccepted
  • Version trunk4.8

Good catch.

#2 @SergeyBiryukov
9 years ago

  • Resolutionfixed
  • Status acceptedclosed

In 41866:

Widgets: In WP_Widget_Media, apply widget_title filter regardless of whether the title is empty, same as other widgets do.

Props Bsop.
Fixes #42226.

#3 @SergeyBiryukov
9 years ago

In 41867:

Widgets: Move empty title checks out of the apply_filters( 'widget_title' ) calls for clarity.

See #42226.

Note: See TracTickets for help on using tickets.