You can try the following to modify the links of the menu items that are pages:
add_filter( 'nav_menu_link_attributes', function( $atts, $item, $args, $depth )
{
if(
isset( $item->object )
&& 'page' === $item->object
&& isset( $args->theme_location )
&& 'primary' === $args->theme_location
)
$atts['href'] = home_url(
sprintf( '/#/page/%d', $item->object_id )
);
return $atts;
}, 10, 4 );
where we target the primary theme location.
This should give this kind of links:
http://example.tld/#/page/12345
Related Posts:
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- WordPress Shortcode in Menu Item Title
- Calling the Menu Title within wp_nav_menu array function
- How to hide an item from a menu to logged out users (without a plugin)
- Menu items (all menus) being deleted randomly on their own [duplicate]
- How to apply a class to the second word in menu list item?
- Put a wp_nav_menu inside another one
- How to add bubble count in WordPress wp_nav_menu menu?
- Add class to active top level (grandparent) menu item
- WordPress wp_nav_menu within iFrame
- Generate a Menu that displays all child pages of top level parent
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- wp_nav_menu doesn’t generate parent/ancestor classes
- WP_nav_menu fallback not working
- How to conditionally register nav menus with advanced custom fields?
- Pending Custom Link in Menu
- Use walker for specific menu, or avoid use of walker
- Change where navigation bar links?
- Social Links Menu displays icon instead of text (twentyfifteen) [closed]
- has_children in custom nav_walker
- How to display the title for each menu item in a span attribute
- Limit top level menu items on wp_nav_menu
- How do you center the main menu in CSS? [closed]
- Wp menu add page link as custom empty link
- How to change the wordpress navigation bar UL to OL in Twenty_Twelve similer theme
- Main Menu and Sub Menu Items for Footer
- Altering html structure and creating custom menus
- How to generate a list of child pages, and use some of their custom fields?
- Why is my menu not ordered properly?
- How to add class to and childs of sidebar widget – WordPress
- Hook for number of items in Appearance > Menus > CustomPostType > View All [duplicate]
- add span to top level links of a wordpress menu called “main”
- How to have two menus using Bootstrap nav walker?
- Unable to center menu and header image twenty twelve [closed]
- Debugging – trying to add search box to menus
- How do I add (css) class to a custom link to make it current_page_item
- Display menu locations in all sites of a multi site
- header menu structure: cannot add additional menu items without alignment issues
- My menu bar dissapeared with autooptimize [closed]
- target nav class in wp_nav_menu
- Admin menu structure
- WordPress default menu in database
- If menu has submenu, add parent as first child
- Create subpages in default WordPress menu
- How to highlight 1st level menu item based on actual page
- Admin-ajax.php 500 error when Add to menu is clicked in admin
- replace existing menu programtically
- Submenu page buttons are blank
- How to add an attribute data-slug = “$specfic_page_slug” in WordPress menu item?
- Main menu gets replaced when second menu is created
- How to add a page to header that is outside of WordPress?
- Get current menu item label for specific parent menu [closed]
- Theme only supports one menu? [closed]
- Problem adding ‘has-children’ class to wp_nav_menu
- set certain item in nav walker to active when on archive pages or singles
- wp_nav_menu() | Outputting my own custom code using built in features
- How to reference argument data for wp_nav_menu() from functions.php
- How do I enable “metaboxes” by default in menu editor?
- The cart, checkout, and shop links not getting removed
- Creating menu always gives error A name is required for this term
- Showing the same menu in multiple location
- Creating custom menu with custom themes
- Expected snippet value not showing
- Wp Nav Menu div containers
- wp_nav_menu with WP as pure CMS
- Add posts from a category to menu with all posts in it as sub menu
- Possible to append class to nav menu added to widget area?
- Page dependent sub-menu?
- Removing wp admin menu item on top bar of admin backend
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- Nav_walker add id to dropdown ul
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- WordPress nav-menus not finding page
- Restrict user to edit only edit a certain menu
- Primary menu items are dissapearing
- Where is the source code in the console coming from?
- Migrate old blogroll to menus automatically
- Getting parent object_id of child menu items in WordPress menu
- display cart information within li of cart menu item
- Calling wordpress menu outside ignores custom menu item
- Active page link not getting class assigned
- Removing menu item doesn’t get removed on edit post
- change link of menu particular tab
- Next page link via the custom menu
- Top menu link anchor href value change after online server?
- Menu not always using correct link
- Custom Menus and taxonomies
- How to handle change the appearance of ‘categories’ box on dashboard?
- wp_nav_menu doesn’t show on index page
- How can I stop wp_nav_menu from returning extraneous root links?
- How to add posts with thumbnails to my dropdown menu?
- Automatically add new posts to a specific menu name
- can anyone help me converting my static menu to wp_nav_menu I’am trying to add static menu item to WordPress Menu
- Elegant way of adding an CTA to a menu
- Two Homes In Navigation Menu
- Theme supports only one menu. I need to add more – but how? [closed]
- Submenu items not working anymore