[wp-trac] [WordPress Trac] #48702: [function] => add_submenu_page

WordPress Trac noreply at wordpress.org
Mon Nov 18 18:17:13 UTC 2019


#48702: [function] => add_submenu_page
--------------------------+----------------------
 Reporter:  j3gaming      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  5.3
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by garrett-eclipse):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Hello @j3gaming thanks for the report.

 Looking at your stack trace the `_doing_it_wrong` error message is being
 triggered as you're supplying one too many params to `add_submenu_page`.
 Specifically, the icon there as only `add_menu_page` has ever supported an
 icon parameter. The `add_submenu_page` to my knowledge never supported an
 icon, could be an interesting feature though if you want to open an
 enhancement request for that (It would require UI changes to support a
 space for icons on submenus).

 The reason why you're seeing an error now with the update is previously it
 was simply ignoring the extra params and now with 5.3 it will detect if
 the `$position` param isn't an int or null and throw the error. As your
 icon is in the place of `$position` it's what's triggering the error.

 I'm going to close this as `invalid` as you should be able to just correct
 the function signature by removing `$iconPin` from the function call to
 `add_submenu_page`.
 P.S. That being said there is an outstanding bug for `add_submenu_page`
 being trac'd here (#48599), but I don't believe it should affect you as
 your `menu_slug` and `parent_slug` are unique in your `add_submenu_page`
 call.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/48702#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list