WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#13344 closed defect (bug) (fixed)

Nav Menu slugs are incremented on each save

Reported by: ryan Owned by:
Milestone: 3.0 Priority: normal
Severity: blocker Version:
Component: Menus Keywords:
Focuses: Cc:

Description

Saving a nav menu generates queries like this:

Query: SELECT t.*, tt.* FROM wp_trunk_terms AS t INNER JOIN wp_trunk_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'nav_menu' AND t.name = 'Main' LIMIT 1
Time: 0.000452995300293
Caller: wp_update_nav_menu_object, get_term_by

Query: SELECT term_id FROM wp_trunk_terms WHERE slug = 'main'
Time: 0.00223398208618
Caller: wp_update_nav_menu_object, wp_update_term

Query: SELECT term_id FROM wp_trunk_terms as t WHERE t.slug = 'main'
Time: 0.000410079956055
Caller: wp_update_nav_menu_object, wp_update_term, wp_unique_term_slug, is_term

Query: SELECT slug FROM wp_trunk_terms WHERE slug = 'main'
Time: 0.000195980072021
Caller: wp_update_nav_menu_object, wp_update_term, wp_unique_term_slug

Query: SELECT slug FROM wp_trunk_terms WHERE slug = 'main-2'
Time: 0.000192880630493
Caller: wp_update_nav_menu_object, wp_update_term, wp_unique_term_slug

Query: SELECT slug FROM wp_trunk_terms WHERE slug = 'main-3'
Time: 0.000185012817383
Caller: wp_update_nav_menu_object, wp_update_term, wp_unique_term_slug

Query: UPDATE `wp_trunk_terms` SET `name` = 'Main', `slug` = 'main-3', `term_group` = 0 WHERE `term_id` = 6103
Time: 0.000320911407471
Caller: wp_update_nav_menu_object, wp_update_term

Query: SELECT tt.term_taxonomy_id FROM wp_trunk_term_taxonomy AS tt INNER JOIN wp_trunk_terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = 'nav_menu' AND t.term_id = 6103
Time: 0.000339984893799
Caller: wp_update_nav_menu_object, wp_update_term

Query: UPDATE `wp_trunk_term_taxonomy` SET `term_id` = 6103, `taxonomy` = 'nav_menu', `description` = '', `parent` = 0 WHERE `term_taxonomy_id` = 69
Time: 0.000323057174683
Caller: wp_update_nav_menu_object, wp_update_term

Query: SELECT autoload FROM wp_trunk_options WHERE option_name = 'nav_menu_children'
Time: 0.000581979751587
Caller: wp_update_nav_menu_object, wp_update_term, clean_term_cache, delete_option 

The next save bumps the slug back to 2. Subsequent saves bounce between 2 and 3. Global terms are off.

Change History (2)

comment:1 ryan4 years ago

I can't get into this situation after deleting and recreating menus. #13345 blocks testing this fully, however.

comment:2 ryan4 years ago

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

I can no longer reproduce this. Likely fixed by [14590] and [14586].

Note: See TracTickets for help on using tickets.