You will need to convert the relative links to absolute links. You can do this in the wp_nav_menu_objects
filter, which gets all menu items. Just edit the url
property of each item.
Another option would be to extend the default Walker_Nav_Menu
with one that overrides start_el()
, so you can modify the passed $item
there before you pass it to the parent start_el()
.
These are relative links you added yourself? If you add a link to a WordPress Page or Post via the menu editor it should be absolute by default.
Related Posts:
- WordPress links https overwrite issue
- Why is wordpress forcing https link generation?
- bloginfo(); outputs wrong urls without https on inner pages
- Site migration and how to write internal links with migration in mind
- Link rewrite to https (NOT URL rewrite)
- How to print translation supported text with HTML URL
- Get the prev / next page links only (not title, etc)
- How to re-enable the links manager?
- Links redirecting to localhost after migration to server
- Count and show Clicks on external links in a single page/post
- get_category_link() is returning nothing
- root-relative links for multiple parked domains
- Get link value only from the_content()?
- Can’t add a class to links in the visual editor since WP 3.1?
- What is the canonical way to link to pages?
- How do I remove or disable “Or link to existing content” in “insert link” dialogue?
- Auto-embed link info from URLs in link post format?
- Disable automatic content hyperlinking
- Deep linking to an accordion tab with Visual Composer
- How to add/change a value of $wpdb property/var?
- Pending Custom Link in Menu
- Custom Post Type archive link in WYSIWYG editor
- Add Link Text Back to Insert/edit link Box
- Force PDF download from custom menu?
- How to list all external URLs that I have posted on my WordPress blog?
- Page-Linking Structure
- Is there any way of changing the post order via user click?
- Creating a navigation link to my front-page
- How to remove author name and link from a shared link preview?
- How to add wechat (weixin) link to navigation menu?
- Relative links for performance?
- Dont’t change active Button while I’m listing a category?
- How do i set the read more link?
- Link that refers to a menu item with dynamically generated URL
- Link to Homepage in Menu
- After duplicating site to a sub folder, links send user to original site
- How to add a WordPress page with multiple picture links?
- Enumerating over a category of links
- Separator for custom nav menu
- Twitter links in widget don’t work?
- How do you link to a place in another page without any styling issues?
- Read more link to external webpage
- Add text excerpt and pictures to hyperlinks?
- WordPress changes URL?
- Parent/child pages and link structure the right way
- Adding existing links to custom navigation menus?
- Link below the footer removal
- link to single most recent post, regardless of category
- Add the title attribute to links
- WordPress relative links for regular non image links
- Trouble getting the Blog page to show up correctly
- How Do I Link My Whole Featured Article Image?
- Change homepage’s logo link [duplicate]
- Allow insecure embedded content in a SSL secured website
- remove the title attribute from links [closed]
- How to prevent WordPress from abbreviating long slugs?
- How do I create a root link in wordpress to a PDF file?
- Position a hard-coded menu item
- Embed/Link external web pages into my WordPress blog (Like Facebook grabs Image, Title, and Description)
- Previous and older set of posts links
- Page to show a link to every file in an directory
- Active class to current link
- Simple form to add custom links to menu?
- Links In Sidebar not displaying
- Display category page number links for older posts
- Blogroll/Lins Menu not visible in my backend?
- 2 item in a same menu pointing to 1 page
- How do I exclude main pages and link only to sub pages?
- What’s the URL to my blogs (from my home page – which is a “page”)
- Custom theme – pages in menu
- Snippet to Format Elementor Text Box Throws Error
- how give a link to an Elementor Pro widget with variable part
- 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
- ddnss linking problem
- No https in url when writing links like:
- How can I get the url from file uploaded in Media Library
- Rotate prefix for external domain links using functions.php?
- Making download links from short code
- Metallex Theme modifies links after saving them
- remove or hide Link Relationship (XFN) form Menus tab
- Add a data attribute to list item element in menu
- Links in new menu don’t work
- Prevent “nofollow” from Being Inserted into BBPress Posts
- Remove all link title attributes
- Links offset on my page
- How to link to specific part of a page in wordpress permalinks
- On main page link image to post page, on post page link it to it’s own image?
- Removing links from posts in WordPress
- WordPress link to show popup box
- Internal linking search box not working – WP 3.2
- External Links Not Working [closed]
- How do I edit a links published date?
- Change menu item order
- Add “sub-nav” class to a sub menu parent item
- Menu System: Custom Links
- How to centre menu items on horizontal nav bar? (e.g. make margins equal) [closed]
- Short website link for all post
- how to add permalink/slug to wordpress custom link menu item
- gallery link not displaying photos