I’m sure what you’re asking can be done, but there’s a far simpler, significantly easier solution, just register each menu multiple times for each language, and show different menus for different languages.
This way you don’t need to figure out how to filter out menu items depending on GET variables, and your pages become more cacheable ( you could modify rewrite rules so that your URLs are pretty and take the form example.com/es/hello-world rather than example.com/hello-world?lang=es )
The benefit of this is that your language menus can be completely different, and they’ll work everywhere on your site, not just on posts and pages
Related Posts:
- Automatically add images to a menu
- Disable Attachment Pages Completely
- Print number of post (in reverse)
- Best practice for migration friendly images in posts/pages?
- get_the_title() gets printed out twice
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Show About and Contact Us page when they’re clicked in the top menu.
- WordPress Search
- Edit and delete permissions pages and posts
- My worpress search page is showing no results
- How can I check if a post with a particular slug or title exists?
- Split post or page content in two or more columns
- Getting page / post URL on publish and / or update
- Get current_post in reverse order with pagination
- List of child pages fetch next results at link click
- How to echo every parent page title?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- How to use mysql LIKE with wpdb?
- Reading settings in the home page precisely home.php
- Do I need to edit my theme in order to change the title of my blog page?
- Add new post in existing categories using wp_insert_post
- WordPress upload file size error even after raising php limits
- Menu Items fail to save correctly, cause reset of related page metadata
- How do I add more options to the post-new.php page?
- Dropdown menu for categories
- Menu Custom Data Attributes
- How to display different submenus?
- get post id from wp_insert_post for get_template_part
- Retrieve Json data and create multiple pages with it
- create front-end users post list by specific category
- Incrementing PHP variable onclick to display posts by month
- Modify main query before it run without pre_get_post
- Displaying list of posts in category page
- Get the name of menu item with wp_nav_menu
- How to add page numbering with php?
- Display child page content of a specific parent on home page
- .html end of URl affected to SEO?
- How can I get “Previous” and “Next” to show in the navigation besides the links?
- Notice: Trying to get property of non-object
- Get the id of all images in a post
- How to set the mainpage of a custom post type?
- Noindex subscriber author page
- Displaying content on posts page based on category
- Do not duplicate posts with multiple categories in multiple loops
- How to use wp_nav_menu to create custom dropdown menu?
- how to make an array of post id’s in is_single
- Loading Posts & Category with Ajax
- How to modify mobile nav menu text in theme
- Four posts per row [closed]
- Get parents child pages
- array_rand not working correctly?
- Output only links using wp_nav_menu()
- Update if post with specific title exists
- Need help removing […] after excerpt
- Get css class of menu item in custom menu structure
- How to add aria role and schema markup to custom walker container
- show recent posts php code error?
- Error display post thumbnails for previous and next post
- How can I use custom menus with a Bootstrap WordPress theme?
- Removing custom sort order from admin page listing
- WP_Query() load selected post
- Nav menu from plugin to theme
- Adding Additional Variables on Menus Page
- Post to WordPress from another Server via PHP
- PHP Output also in Child theme, but different
- Unable to render custom field after attempt to generate a list of recent post in page template
- Extend Menu Walker Output
- $wpdb->get_results breaking page?
- how to edit a specific post slug using a php code?
- form $_post action value gets truncated after it passes through two forms
- Unique PHP on each Page
- How to Display a List of Child Pages For a Parent Page in WordPress
- Nav-Menu not showing up
- How to pick “full/thumbnail” images in the loop?
- If is page, archive or search output this code
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Saving a post ID to use in a form elsewhere on website
- Custom navigation menu with awsAccordion
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Update value of a associative array with update_post_meta
- List all anchor links on a page
- Wrap posts p tags in div
- Why in this WordPress theme I can’t see the Main Menu?
- Show login greeting above sub-menu links?
- Why can’t I add a custom image in my navigation?
- Toolbar Hidden in a Virtual Page
- Remove submenu item from list
- conditional: if is page, and all subpages
- wp nav menu: show submenu below li item
- How to tell if a user has gone in and created a menu
- Dynamic Menu drops pages?
- Class for Selected Menu using wp_nav_menu
- Remove the Tag from wp_nav_menu
- Menu not styling. New menus functionality giving me a headache
- Styling an “active” link outside of WordPress default menu
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- How to create Loop code for Menu using WordPress?
- Hard-coding a shortcode as the last menu item in primary navigation?
- Dynamic menu with custom post types