Following on the following post in this community, we're going to look at another type of query that can be improveed by using transients. To retrieve that menu, WordPress has to query the directory to find all of the menu number associateed with that menu and all of the data associated with them. Ever nearly every topic now uses this method to display menus on your page, so you should have some different looking code in your theme files.. If it does not, we go ahead and run the query to retrieve WordPress menu. By default, wp nav menu voicees the result of the query, and we want to return the data to PHP to be storeed as lasting, so we need to add the reason 'echo => 0 to the part, n in line 12. set our lasting with that data using set transient, so that it can be reuseed on the first page load. On line 17, we have to make gift we need to voice the result in order to actually see it, so we add in this line to achieve that.. we have set time for the data, after which we want to illegally replace it. I hooked into the action, which fires every time WordPress menu is updateed. Not that this would not make power, just probably not as great as the one in your first post about WP Query..
Read more