Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#17031 closed defect (bug) (invalid)

Saving navigation menu items is slow

Reported by: pellaeon's profile pellaeon Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Menus Keywords: close
Focuses: Cc:



I have about 90 items in the Wordpress navigation menu. Even if I disable all plugins and use the default theme, saving it takes about 30 seconds.

Sometimes it would return a blank page, but the changes are saved. Sometimes it returns 500 internal server error.

Another site admin told me that she once refreshes the page when it's still saving. Then she lost all items in the menu (it returned an empty menu).

I use Wordpress 3.1 with Apache. Tested with Firefox 4 and Chromium 10, same result.

Thank you!

Change History (13)

#1 @pellaeon
13 years ago

  • Component changed from General to Menus

#2 @linuxologos
13 years ago

  • Cc linuxologos@… added

#3 @solarissmoke
13 years ago

  • Keywords reporter-feedback added

Can you please put the following in your config.php file to enable debugging

define('WP_DEBUG', true);

and then tell us what error messages are issued when you have this problem?

#4 @nacin
13 years ago

I'd also like to see a dump of the queries.

#6 @pellaeon
13 years ago

I cannot reproduce the "blank page" problem and 500 internal server error, so please just ignore that.

With WP_DEBUG set to false, the nav-menu could be saved successfully. (but it takes about 30 seconds)
With WP_DEBUG set to true, it could still be saved successfully, without any error messages.

I've looked into the mysql query log. I'm surprised to found that it takes about 2250 queries to save the nav-menu, no wonder it's so slow.

It even UPDATE some post contents... Why would it need that?...

MySQL query log:

#7 @SergeyBiryukov
13 years ago

  • Keywords dev-feedback added; reporter-feedback removed

So it's basically a duplicate of #14134 and #16799, or a large number of queries is another issue?

#8 @robjuurlink
12 years ago

  • Cc robjuurlink added

Any updates on this?

I have the same issue. Using WordPress 3.3.1 it takes ages to save the custom menu. I had to bump page execution time to 60 seconds. But that is insane. Even the smallest changes take ages to load. Custom menu saving is not efficient.

There are approximately 200 menu items in one custom menu.

#9 @ruud@…
12 years ago

  • Cc ruud@… added

Hi, I have the same problem as well. Once a custom menu gets over a certain size.. no more saving, just application 500 server errors. In my case it takes approx 1 minute to get to this point. As a work-around I'm currently trying a max_connections of 300 in the MySQL settings.
Hope this gets fixed soon.
Another work-around I've made to circumvent this is to make separate menu's and then include them into each other via a 'relation' via the xfn tag... (this off-course is totally insane, but it works) like this (in an extended Walker_Nav_Menu class:

   $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
   if ( !empty( $item->xfn ) ) {
	$submenu = wp_nav_menu( array(
		'echo' => 0,
		'fallback_cb' => '',
		'theme_location' => $item->xfn,
		'menu_class' => 'sub-menu',
		'container' => false )
	$output .= $submenu;

#10 @ruud@…
12 years ago

sorry: using version 3.3.1

#11 @ruud@…
12 years ago

Tried the max_connections=300.. but didn't work. I did however found my problem: WPSearch2 plugin. After disabling it, the menu saved fine.

PHP Fatal error: Maximum execution time of 0 seconds exceeded in /var/www/vhosts/example/htdocs/wp-content/plugins/wpsearch/WPSearch/Backends/Phplucene/Zend/Search/Lucene/Index/SegmentWriter.php on line 457, referer: http://example/wp-admin/nav-menus.php

So I guess saving the menu somehow triggers some code in the WPSearch plugin.
Sorry for this mix-up.

#12 @solarissmoke
12 years ago

  • Keywords close added; dev-feedback removed

#13 @jkudish
12 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.