Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#4316 closed defect (bug) (duplicate)

Widgets with multiple instances (like RSS or Text) not receiving $number

Reported by: adamrbrown Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.2
Component: General Keywords: widget
Focuses: Cc:


In v2.2, the new widgets infrastructure does not appropriately pass a $number argument to widgets that have multiple instances (i.e. widgets like the RSS and Text widgets, which have more than one instance--but this defect does NOT apply to the RSS and Text widgets themselves, since they were updated with 2.2).

Example: I have two widgets in the plugins repository. Neither is receiving a $number parameter. These are the only arguments being passed:

    [name] => Sidebar 1
    [id] => sidebar-1
    [before_widget] => <li id="kb-advanced-rss-2" class="widget 2">
    [after_widget] => </li>
    [before_title] => <h2 class="widgettitle">
    [after_title] => </h2>

There also needs to be

    [number] => 1

Otherwise instances after the first of this widget look exactly like the first instance.

My two widgets are among several in the wordpress.org plugins repository that are modeled after the previous RSS and Text widgets, using the exact same method to allow users to have multiple instances. Thus, this defect has probably broken many, many plugins.

I've patched my plugins with a messy workaround that extracts the number from the class in "before_widget." But fixing this defect is necessary for backwards compatibility, i.e. so the same widget can be used in older and new versions of WP.

Change History (3)

#1 @foolswisdom
14 years ago

  • Milestone set to 2.2.1

#2 @ryan
14 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

Same as #4275

#3 @JeremyVisser
14 years ago

  • Milestone 2.2.1 deleted
Note: See TracTickets for help on using tickets.