Remove li Elements From wp_nav_menu

WordPress will allow you to modify or remove the <ul> element from wp_nav_menu but that's it. You cannot remove the <li> items of the navigation by using the default parameters.

Using a simple PHP function, we can easily remove the li items as well, and this is how you can do it.

Need help with this on your own site?

Our WordPress security team can audit, fix and harden your site, or just answer a quick question.

Ask about secure setup

Related posts