• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Free
  • Premium
  • Membership
    • Login
  • Design
  • Blog
  • About
  • Contact
Home » How to add custom menu item to the WordPress nav menu

How to add custom menu item to the WordPress nav menu

2020-02-15 by Gabor 1 Comment

The content between the li tags could be anything You want!

For example shortcode for language switcher, social icons or custom text.

// =========================================================================
// ADD CUSTOM MENU ITEM TO THE WORDPRESS NAV MENU
// =========================================================================
function add_custom_menu_item ($items, $args) {
    $items .= '<li id="menu-item-5000" class="menu-item menu-item-type-post_type menu-item-object-page last">';
        $items .= 'Last Menu Item';
    $items .= '</li>';
    return $items;
}
add_filter( 'wp_nav_menu_items', 'add_custom_menu_item', 10, 2 );

Filed Under: Free Tagged With: WordPress

Reader Interactions

Comments

  1. AffiliateLabz says

    2020-02-16 at 02:14

    Great content! Super high-quality! Keep it up! 🙂

    Reply

Leave a Reply Cancel reply

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

Primary Sidebar

  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
WP Rocket - WordPress Caching Plugin
UpdraftPlus Premium

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy
  • Terms of Service
  • Flames Design
© 2021 WP Flames - All Right Reserved