Speed up WordPress CMS Menu Loading

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Overview

We can customize the WordPress navigation menus with writing few lines of codes.

wp_nav_menu is the WordPress menu function to display custom menus created in domain.com/wp-admin>Appearance>Menus panel . It is a must use function but it’s not perfect for all website or projects. Default menu function OK for small websites but if your site is large and have more traffic with several menus then It may create website speed and performance issues.

What should i do for performance upgrade for wp_nav_menu?

Majority site menu are not updated frequently so its a good idea to cache your menus for long expired period.

How to cache your menu?

If your WordPress version is 3.9+ you can use Transients API and pre_wp_nav_menu. I am not going to write long story here. for your convenience i added my code below.

Please copy this code and past it to you Theme function.php file

Comments

comments