A Workaround for the number of menu items limit in WordPress.
As I was working on a site, I found that managing the menu structure was becoming unwieldy. I wanted to have a menu structure that was similar to the way the categories were structured. I found a workaround that gives me the UI I want.
There are two limits to the size and complexity of a WordPress menu. The first is that it becomes difficult to add additional menu items or maintain the structure especially if you have nested menus. If you have worked with any large nested menus you have probably run into this. The second limitation has to do with the php configuration. There are ways to modify the configuration but I was a bit reluctant to apply such changes. The other issue is that I am using my hosting to ‘grow’ a couple of sites and am pushing the server resources as it is.
The upper limit for the number of menu items with most configurations is not that large. You can end up losing your menu at about 80 items or so.
The workaround I am using is to use a page as a sub menu. That isn’t the best practice for UIs but it will work. In the case of www.bucksviews.com, I wanted to start adding all of the towns in Bucks County. When I tried to do this with sub items in the menu, I became frustrated. The frustration, coupled with the php limitations on menu size led me to look for a workaround.
Instead of having the towns as sub menu items of of “Towns”, I created a page called Towns. On that page, I have the individual towns listed. (Yes, the layout needs a lot of work as of February 2018).
In the image below, you can see a standard dropdown for News, Weather and Traffic. My original intent was to have a dropdown for “Towns’. However, that would have resulted in 52 sub menu items. That is unwieldy on a desktop and unworkable on a phone. In the menu below, Towns has no sub menu items but simply links to a page called “Towns”
The image below shows the Towns item in the menu structure. It is only one menu item vs 58 if I tried to put the towns in as sub menu items.
The image below shows the landing page for towns. At the point this screenshot was taken, I was just starting to work on the page. In the case of Bensalem Township – Bensalem site, “Bensalem Township” is a link to http://www.bucksviews.com/category/towns/bensalem/ . This will take the user to the categories page for Bensalem. I’m planning on running the interface by some people to make sure that this works. If it does, I might take some other sections of the menu structure and convert that to landing pages.
- There are limitations to the size and complexity of WordPress menus due to the menu design interface and PHP limitations. Large menus can put a load on the hosting.
- The PHP limitations could be addressed by modifications to php.ini. However, this does not address the usability issues for the developer or user.
- Setting up a landing page works around some of the issues.
By the way, the large menu problem can cause a LOT of aggravation.
Sidenote: If this happens, it’s all over. We haven’t just lost pointers, we’ve lost the actual data. The only way to recover the menu items would be to restore a backup of the database prior to the menu save. Gotta catch it before it happens to avoid the repercussions.
- Bucksviews site to see the workaround in action
- Solved – Menu won’t reorder in Joomla after migration from 1.5
- Adding an Anchor Link to Headers in WordPress with Gutenberg
- Mobilizing joomla sites with Jtouch
- An example of why you should use the featured image feature in WordPress
- Preventing images from overflowing a column in WordPress with an Artisteer theme and possibly other themes.
- Windows Mobile – Emailing a URL with a Saga
- A great cheat sheet on image sizes for social media headers and profile pics.
- Twitshot allows you to easily post images from your blog to Twitter