WordPress.org

Make WordPress Core

Opened 8 months ago

Closed 7 months ago

#25152 closed enhancement (fixed)

Ability to pass arguments to callback for dashboard widget

Reported by: jdgrimes Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

There are times where it would be useful to be able to pass some arguments to the callback function for a dashboard widget when adding it with wp_add_dashboard_widget(). This would make it possible to have multiple 'instances' of a dashboard widget if desired.

For reference, I'm not the only one who has felt this need: http://wordpress.org/support/topic/add-parameters-to-the-callback-function-in-wp_add_dashboard_widget?replies=2

Also, add_meta_box(), which wp_add_dashboard_widget() calls, already supports this. All we need to do is add another argument to wp_add_dashboard_widget() and pass it along to add_meta_box(). The attached patch does just that.

Attachments (1)

25152.patch (960 bytes) - added by jdgrimes 8 months ago.
Adds $callback_args parameter to wp_add_dashboard_widget()

Download all attachments as: .zip

Change History (3)

jdgrimes8 months ago

Adds $callback_args parameter to wp_add_dashboard_widget()

comment:1 SergeyBiryukov7 months ago

  • Milestone changed from Awaiting Review to 3.7

comment:2 nacin7 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 25454:

Allow callback args to be passed from wp_add_dashboard_widget() to add_meta_box().

props jdgrimes.
fixes #25152.

Note: See TracTickets for help on using tickets.