WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 11 days ago

#42791 assigned enhancement

wp_add_dashboard_widget() should accept location and priority parameters

Reported by: johnbillion Owned by: davidjlaietta
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: good-first-bug has-patch needs-unit-tests
Focuses: Cc:

Description

The wp_add_dashboard_widget() function should accept $location and $priority parameters to bring the function inline with add_meta_box(), which it ultimately calls.

Attachments (2)

42791.diff (2.4 KB) - added by davidjlaietta 3 months ago.
42791.2.diff (2.5 KB) - added by davidjlaietta 11 days ago.

Download all attachments as: .zip

Change History (6)

@davidjlaietta
3 months ago

#1 @davidjlaietta
3 months ago

Attached diff includes $location and $priority arguments, and maintains similar logic for wp_add_dashboard_widget.

If location is not set, it'll be set to normal unless it's a side widget. If priority is not set it will be set to core unless dashboard_browser_nag is set, then it'll be set to high.

New usage:

wp_add_dashboard_widget( 'widget_id', 'Widget Name', callback_function, control_callback, array(), 'side', 'high' );

#2 @chetan200891
2 months ago

  • Keywords has-patch added; needs-patch removed

#3 @DrewAPicture
2 weeks ago

  • Keywords needs-unit-tests added
  • Owner set to davidjlaietta
  • Status changed from new to assigned

Hi @davidjlaietta, thanks for the patch! I've assigned the ticket to you to mark this good-first-bug as "claimed". Sorry for the delay in response.

I did a first pass on the patch, and the big standouts that are still missing are changelog entries for the new parameters in the DocBlock, and we could probably also benefit from unit tests here as well.

For info on changelog entries, check out this article in the core handbook.

#4 @davidjlaietta
11 days ago

The updated patch includes a changelog entry in the docblock

Note: See TracTickets for help on using tickets.