Make WordPress Core

Opened 9 years ago

Closed 5 years ago

Last modified 4 years ago

#16865 closed enhancement (fixed)

'post' definition should use menu_position

Reported by: scribu Owned by: wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch
Focuses: Cc:


Since WP 3.1, we don't need to hardcode the Posts $menu array, since register_post_type() is flexible enough to handle it.

Attachments (3)

16865.diff (4.0 KB) - added by scribu 9 years ago.
16865.2.diff (6.2 KB) - added by scribu 9 years ago.
enclosing function
16865.3.diff (6.9 KB) - added by wonderboymusic 5 years ago.

Download all attachments as: .zip

Change History (12)

9 years ago

9 years ago

enclosing function

#1 @scribu
9 years ago

16865.2.diff wraps most of the code in an enclosing function, so that we don't have to worry about polluting the global namespace with temporary vars anymore.

Last edited 9 years ago by scribu (previous) (diff)

#2 @scribu
9 years ago

  • Milestone changed from Awaiting Review to Future Release

#3 @chriscct7
5 years ago

  • Keywords needs-refresh added; has-patch removed

#4 @wonderboymusic
5 years ago

  • Keywords has-patch added; needs-refresh removed
  • Milestone changed from Future Release to 4.4

16865.3.diff refreshes this. Posts and Pages can opt in via menu_position when registering the post type. Requires a few things in the post type loop below

#5 @wonderboymusic
5 years ago

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

In 33723:

With a few modifications in wp-admin/menu.php, we can eliminate the extra logic for Post and Page menu registration. Instead, they can just declare menu_position on post type registration.

Props scribu, wonderboymusic.
Fixes #16865.

#6 @ryan
5 years ago


Notice: Undefined variable: i in /.../wp-admin/menu.php on line 57

This ticket was mentioned in Slack in #core by boren. View the logs.

5 years ago

#8 @wonderboymusic
5 years ago

In 33867:

After [33723], ensure that $i is properly set before looping.

See #16865.

#9 @obenland
4 years ago

In 35590:

Menu: Continue to use post dashicon as default menu icon.

Prevents a bug where custom post types without a specified menu icon would
adopt the menu icon of the preceding post type. Introduced in [33723].

See #16865.
Fixes #34637.

Note: See TracTickets for help on using tickets.