ClassicPress icon indicating copy to clipboard operation
ClassicPress copied to clipboard

Added 7nth Parameter $position to add_submenu_page

Open smileBeda opened this issue 3 years ago • 7 comments

Description

Added the ability to define submenu position in add_submenu_page(). Possible values are numeric integers or float. Throws a "Doing it wrong" if anything else is passed.

Motivation and context

I was creating a Plugin for ClassicPress, wanted to define its menu position and saw it is not possible. Realised the add_submenu_page() function only supports the menu position since 5.3, see https://developer.wordpress.org/reference/since/5.3.0/

How has this been tested?

On local install with Plugin using this new feature (and also not using it, and using it wrongly), with WP Debug turned on.

Screenshots

Without the feature - menus are pushed to last position With the feature, this is position 3 passed

Types of changes

  • New feature (in CP. It is an existing feature in WP)

smileBeda avatar Jun 06 '22 05:06 smileBeda

Thanks, I think it is because I edited it on Git Directly. In any case, looking good but I cannot accept the change, as I am the author of the PR :(

Needs thus review from a third (and fourth) person to accept your indentation amendments.

smileBeda avatar Jun 06 '22 14:06 smileBeda

In any case, looking good but I cannot accept the change, as I am the author of the PR :(

I haven't done any change, just asked for. You can (if I've understood) just change indentation and push to your branch to modify this PR.

xxsimoxx avatar Jun 06 '22 14:06 xxsimoxx

I'm sorry, I was looking at my own commit 🙄 This should be corrected now to use tabs.

smileBeda avatar Jun 07 '22 03:06 smileBeda

This pull request has been mentioned on ClassicPress Forums. There might be relevant details there:

https://forums.classicpress.net/t/add-7th-argument-for-add-submenu-page-position/4099/9

ClassyBot avatar Jun 08 '22 03:06 ClassyBot

From WP File blame these are some of the changesets for the amendments.

https://core.trac.wordpress.org/changeset/42394 https://core.trac.wordpress.org/changeset/46197 https://core.trac.wordpress.org/changeset/46198 https://core.trac.wordpress.org/changeset/47060 https://core.trac.wordpress.org/changeset/51955 https://core.trac.wordpress.org/changeset/52035 https://core.trac.wordpress.org/changeset/53104 https://core.trac.wordpress.org/changeset/53264

bahiirwa avatar Jun 13 '22 10:06 bahiirwa

Re-opening as this is a good change to consider for CP Core

mattyrob avatar Jun 18 '22 17:06 mattyrob

Unfortunately smileBeda:patch-6 branch has been deleted and needs to be restored as we did with https://github.com/ClassicPress/ClassicPress/pull/1109

bahiirwa avatar Sep 19 '22 08:09 bahiirwa

Closing in favour of #1128 where we can handle any future conflicts more easily.

mattyrob avatar Nov 21 '22 17:11 mattyrob