Menu Editing VERY slow

Hey Everyone.

I have noticed an issue with the menu editor being super slow when using X-Theme. When I have a menu with several items in it, it almost becomes unusable to make any changes to. I figured at first it was an issue with our server, and spent several hours with our hosting companies technical support to see if there were any issues with memory, execution time, php configuration, etc… but what seemed to be the big culprit were the additional fields that the theme was adding to the menu items, which caused javascript execution to start ballooning exponentially until it eventually freezes client-side.

I did some digging and I found for me that the best solution was to remove these additional fields using this code:

// ==================================
// Remove custom fields for menu	
// ==================================
add_action('init', 'remove_these', 10 );

function remove_these() {
	remove_all_actions( 'wp_nav_menu_item_custom_fields', 10);
    remove_all_actions( 'wp_update_nav_menu_item', 10 );
    remove_all_filters( 'manage_nav-menus_columns', 10 );
}

I just wanted to share this with anyone who was running into this issue, and to bring this up to staff to flag it as a potential fix in the future.

Thanks!

1 Like

Hi @michigancreative,

Although we never had encountered such issues till now, still we appreciate that you shared it for others.

Thanks

Thanks for sharing! I’ve been having the same issue too. At first I thought it was browser problem because Firefox would all but freeze. Now I’m having problems with Chrome & FF.

If you don’t mind me asking, what file are you adding this code into?

Hi @mark51,

You can add the code into your child theme’s functions.php. Please remember that code provided is a sample code, and it varies from case to case, and we can’t guarantee it works for you.

Thanks

It’s my pleasure! Glad I could help because it took me a while of digging through this form before I found this solution. It would be great to have you guys take a peek at this when you get a chance because it has been something I have run into for a while now.

To recreate it, just install X-Theme Pro and start adding items to the menu, once you hit 10+ you will notice your browser quickly becoming unresponsive and if you monitor the network and performance tab of the inspect menu you will notice that JavaScript execution is what is causing the hang.

Thanks!

Thanks for sharing, @michigancreative

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.