February 18

0 comments

A Workaround for the number of menu items limit in WordPress.

By Christopher G Mendla

February 18, 2018


Last Updated on September 21, 2023 by Christopher G Mendla

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”

WordPress Menu Workaround - Landing Page
WordPress Menu Workaround – Landing Page

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.

WordPress Menu Workaround - Back End Menu Design
WordPress Menu Workaround – Back End Menu Design

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.

WordPress Menu Workaround - Front End Menu
WordPress Menu Workaround – Front End Menu

Summary:

  • 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.

Source: Seven Spark Article

Further Reading

Christopher G Mendla

About the author

A web developer living in Southampton, PA

Self motivated critical thinker and problem solver providing technology consulting services.

Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}