Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21445 closed defect (bug) (duplicate)

add_object_page() from admin_menu action: overwrites last menu

Reported by: scottconnerly's profile scottconnerly Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Administration Keywords:
Focuses: Cc:

Description

When the action admin_menu is fired, I have seen add_object_page() overwrite the last custom post type menu item. $_wp_last_object_menu is supposed to control this, but in this case, it failed.

Custom post types occupied menu positions 26 - 34. then calling add_object_page() at admin_menu overwrote position 34.

Changing the last post type's position to be 40 (so custom post types now occupy positions 26-33, 40), then add_object_page still resides in position 34, and the last post type still resides in 40.

Looking at the code, I can't find the bug myself, would appreciate assistance in pinning down the root cause.

Change History (3)

#1 @SergeyBiryukov
12 years ago

  • Component changed from Menus to Administration

Related: #12718

#2 @hidgw
12 years ago

  • Cc hidgw added

#3 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

add_menu_page() should be used instead of add_object_page().

Going to close as duplicate of #23095.

Note: See TracTickets for help on using tickets.