Make WordPress Core

Opened 3 years ago

Last modified 8 weeks ago

#34657 reopened defect (bug)

WordPress doesn't set object terms for menu items so pending items not working

Reported by: rss_samuel Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.3.1
Component: Menus Keywords: dev-feedback, has-patch, reporter-feedback, bulk-reopened
Focuses: administration Cc:

Description (last modified by SergeyBiryukov)

When I create menu items and refresh admin page without saving menu, wordpress can not show pending menu items.

At line 1127 of 'wp-admin/includes/ajax-functions.php' file there is wp_save_nav_menu_items function, the first argument for this function is always zero, so At line 441 of 'wp-includes/nav-menu.php' file wp_set_object_terms function doesn't work.

I add my menu id to

$item_ids = wp_save_nav_menu_items( 97, $menu_items_data );

function, and it working for me. :)

Attachments (1)

34657.patch (1.2 KB) - added by rss_samuel 3 years ago.
I change /wp-admin/includes/ajax-actions.php file.

Download all attachments as: .zip

Change History (8)

#1 @SergeyBiryukov
3 years ago

  • Description modified (diff)
  • Summary changed from Wordpress doesn't set object terms for menu items so pending items not working to WordPress doesn't set object terms for menu items so pending items not working

#2 @welcher
3 years ago


Thanks for the ticket! It looks like you have an idea of how to address this - did you want to submit a patch?

#3 @welcher
3 years ago

  • Keywords needs-patch added

3 years ago

I change /wp-admin/includes/ajax-actions.php file.

#4 @rss_samuel
3 years ago

After changes it works for me.

#5 @welcher
3 years ago

  • Keywords dev-feedback has-patch reporter-feedback added; needs-patch removed

Thanks for the patch!

Just one thing - I'm not sure we should be dying if $_POST['menu'] is not set. That block is meant to check whether the user has the capability to do this and it shouldn't ( in my opinion ) care if that item is set.

If we're just wanting to be sure that there is a value passed to the wp_save_nav_menu_items it might be a good idea to use a ternary instead.

i.e $menu_id = ( isset( $_POST['menu'] ) ) ? absint( $_POST['menu'] ) : 0;

Last edited 3 years ago by welcher (previous) (diff)

#6 @iseulde
4 months ago

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

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#7 @JeffPaul
8 weeks ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.