{"id":4485,"date":"2021-01-17T19:02:51","date_gmt":"2021-01-17T19:02:51","guid":{"rendered":"https:\/\/gabfire.com\/?p=4485"},"modified":"2021-01-17T19:02:51","modified_gmt":"2021-01-17T19:02:51","slug":"remove-li-elements-from-wp_nav_menu","status":"publish","type":"post","link":"https:\/\/gabfire.com\/?p=4485","title":{"rendered":"Remove li Elements From wp_nav_menu"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/gabfire.com\/wp-content\/uploads\/2000\/01\/wp-1024x480-1.jpg\" alt=\"\" class=\"wp-image-4488\"\/><\/figure>\n\n\n<p>WordPress will allow you to modify or remove the &lt;ul&gt; element from wp_nav_menu but that&#8217;s it. You cannot remove the &lt;li&gt; items of the navigation by using the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_nav_menu\/\">default parameters<\/a>.<\/p>\n<p>Using a <a href=\"https:\/\/www.php.net\/manual\/en\/function.strip-tags.php\">simple PHP function<\/a>, we can easily remove the li items as well, and this is how you can do it.<\/p>\n<p><script src=\"https:\/\/gist.github.com\/gabfire\/b8a95d1ba8f8685e93f2a6ecbbccf4f8.js\"><\/script><\/p>","protected":false},"excerpt":{"rendered":"<p>WordPress will allow you to modify or remove the &lt;ul&gt; element from wp_nav_menu but that&#8217;s it. You cannot remove the &lt;li&gt; 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.<\/p>\n","protected":false},"author":1,"featured_media":1000061,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-4485","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippets"],"jetpack_featured_media_url":"https:\/\/gabfire.com\/wp-content\/uploads\/2000\/01\/wp.jpg","_links":{"self":[{"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/posts\/4485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gabfire.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4485"}],"version-history":[{"count":0,"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/posts\/4485\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gabfire.com\/index.php?rest_route=\/wp\/v2\/media\/1000061"}],"wp:attachment":[{"href":"https:\/\/gabfire.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gabfire.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gabfire.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}