[wp-trac] [WordPress Trac] #37893: Implementation of is_registered_sidebar() doesn't match its documented signature

WordPress Trac noreply at wordpress.org
Wed Aug 31 11:26:37 UTC 2016


#37893: Implementation of is_registered_sidebar() doesn't match its documented
signature
--------------------------+-----------------------------
 Reporter:  mdgl          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Function `is_registered_sidebar()` was added in release 4.4 but the
 documentation for its function signature was changed after the initial
 commit and now no longer matches the implementation (see #24878).

 The implementation of the function requires the string kind of sidebar
 "id" and will not accept a numeric "id" which would first need converting
 to a string of the form "sidebar-$id".

 The simplest fix would be to just change the documentation, but if this
 function is considered useful for themes/plugins (as I suspect it is),
 additional code would be needed to convert a numeric parameter
 appropriately (see the beginning of existing function
 `is_active_sidebar()` for example).

 If this code change is applied, then for consistency a similar change
 should probably be made to function `unregister_sidebar()` which also only
 accepts a string sidebar "id" and confusingly refers to it as the "name"
 (this more properly refers to the displayable name/title for the sidebar).

 Suggested patch incoming, although in the patch I didn't rename the
 parameter to `unregister_sidebar()` as I'm not sure whether there are any
 backwards-compability issue with that.

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


More information about the wp-trac mailing list