I am working on a wp site where I need to manage 500s of child pages for a single page such as About menu can have more child pages need to manage those child pages as sub menu and I have more than 5 such menus.
My client is saying that it will cause load to the server. Does this create a problem in server? If yes, is there any way to load the menu that will not cause any problem to the server.
Thanks in advance…
In general it should not be a big problem. The built of the menu could be slow, so your best option here is to cache the menus with transient.
In this way you reduce the databasequeries to a minimum, compared to building the whole menu each time.
To avoid having the wrong menu after changing and saving the menu, delete the transient on the
wp_update_nav_menu
action.Everything clear so far?
Yes, it will create high load for the basic WordPress installation. To be able to have a functioning site you will have to employ caching. If the site is static in nature then using caching plugins like super-cache or w3tc can be enough, but if you can’t use any of them because the site is very dynamic you will have to cache the menu in your code and do something like
In your theme’s functions.php file add
in your theme’s header.php file replace the menu generation code with
The drawback with this code is that each time a post/page/attachment etc is saved you recalculate the menu which might make saving slower, so you might want the recalculation to be limited to only when a page on menu is changed.
Side note: With so many pages in hierarchy the pages admin might become slow.