If you’re not using the default menu manager then already following a bad practice. Without using the menu manager you can create menu the way you’re doing but I think get_permalink()
will add some flexibility in this case or you can check the user contribution section of get_permalink()
. There are some nice examples which might be helpful for you.
Related Posts:
- Add custom menu item using wp_nav_menu_items filter
- Removing link ” from ” menu for some “links” without JS
- Using filters to change href of nav menu page link
- Links open only on new tab or window
- How to get current page menu item name instead of full menu item list
- Adding different classes to anchor in navigation menu
- Pending Custom Link in Menu
- Force PDF download from custom menu?
- Page-Linking Structure
- How to add wechat (weixin) link to navigation menu?
- Admin only menu/page
- Image as a link using wp_nav_menu()
- Link that refers to a menu item with dynamically generated URL
- Fragment URL in navigation item without a custom link
- Link to Homepage in Menu
- Separator for custom nav menu
- How do you link to a place in another page without any styling issues?
- Custom Links menu items include in Search Results
- Menu custom link not working for external site
- Why is wordpress forcing https link generation?
- Links do not open from click, only in new tab [closed]
- Adding existing links to custom navigation menus?
- How to change the link on the logo at the menu?
- The cart, checkout, and shop links not getting removed
- URL links consistent with menus?
- Opening Menu link in another tab
- Active class to current link
- How to add class to anchor using wp_nav_menu
- Simple form to add custom links to menu?
- Main menu navigation links and new pages
- custom menu widget where menu title is a link
- 2 item in a same menu pointing to 1 page
- How to show pages in menu without link
- Problem with links once in portfolio item
- How to create a link-less parent (top level) menu item that doesn’t use an anchor tag
- Menu links URL with PHP GET method
- Classes CSS (Optional) – how do I reference this in php?
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Parent link need to go first child submenu
- Add a data attribute to list item element in menu
- Links in new menu don’t work
- How to make menu output links absolute
- change link of menu particular tab
- Menu Structure with Links failure to update
- Top menu link anchor href value change after online server?
- Show content of subdomain from specific menu-item?
- Navigational error
- How do I add a link to the menu that has a charector (?) in it?
- Set a different home link in nav menu
- Remove link from Page name in navigation bar
- Change menu item order
- Menu System: Custom Links
- Unsual behaviour of navigation Menus
- How to centre menu items on horizontal nav bar? (e.g. make margins equal) [closed]
- Wrapping my ‘s with
- Displaying list of random links using wp_nav_menu
- WordPress removes URL parameters from menu elements when saving the menu
- how to add permalink/slug to wordpress custom link menu item
- Main Menu Hover is Always White
- Why do Custom Nav Menus generate so many classes on list items? Can I manage this somehow?
- Custom search filter causes menu and query_posts problems
- How to add menu to Dashboard that can be viewed by all users
- List children of second level sub page
- Show top-level parent with submenu menu walker
- Add section to custom menu panel
- Adding menu items dynamically using wp_nav_menu_objects
- Highlight the “Home” / “Blog” button while on main page
- how to add Custom menu item like User name in Header Menu only
- Menus – Open items in new tab/window?
- Custom Menu url is Empty
- Menus don’t appear in admin area / WordPress Multisite
- Programmatically add existing pages and subpages to Appearance Menu
- Appearance Menus Screen – menu item drop down menu not functioning
- Make a navigation menu in the same post [duplicate]
- Highlight parent if item from submenu is active
- changing host.. data loss
- How to buid wordpress menu with auto width sub-menu items in dropdown menu without any items sharing one line [closed]
- Wrapping menu’s top-level link and sub-menus in div
- Tageting a specific menu link with nav_menu_css_class
- Style wp_link_pages as a select drop down list
- Question about Menus on WordPress
- Bootstrap menu – make menu entries with submenu not clickable
- Using menus to link to sections on the home page
- How to change the navigation menu
- Adding widget to sidebar which contains current page’s submenu
- WordPress theme editor not showing
- How to switch menu location in this header.php?
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- Jump to section on another page from menu item
- Users are required to login to my site. How define user.member boolean, its permissions, and conditionally display/handle behavior based on it
- Add items to a menu
- Use menu structure for permalinks
- Add tooltips with image in WordPress Menu?
- How to make a drop down menu with categories
- Add class to current category menu item
- WordPress wp get nav menu items does not deliver external link
- Site pages show the page title under navigation bar
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- Using walker to display all menu branches at once?
- How to add a class directly on a unordered list element that is a primary navigation