-
-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Timber::get_pages_menu() throws warnings when using Polylang #2922
Comments
Hi @lnorby , This might have something to do with how you are setting up your menus. if you are using the Timber::get_menu function you could try this: // use
$menu = Timber::get_menu( 'my-menu', [
'menu' => YOUR_MENU_ID,
'theme_location' => 'YOUR_REGISTERED_MENU_LOCATION'
]
); If that does not help, please post the code how you set up the menu that causes this issue. Edit: @timber/rangers This might be a bug? Here we set |
I am using
Maybe you could set these as default arguments for the method. Edit: |
Hmm, looking at the default arguments for wp_page_menu()'s which Timber is using, there are no menu and theme_location arguments. https://developer.wordpress.org/reference/functions/wp_page_menu/ So adding these two parameters to get_pages_menu is not something that is standard in WordPress as well. Polylang might be checking for the wrong parameters when handling a pages menu? |
The |
Hi @lnorby , I took another look at this and I think what leads to your error is the following:
@timber/rangers , is this something the encourage to fix by the user themself or do we want to improve the compatibility since we are actively calling the |
@timber/rangers We’ve already done a lot of work to make Timber more compatible with native menu filters. If we can improve compatibility here, I think we should. |
Expected Behavior
Expected to not get any warning messages.
Actual behavior
Warning:
Undefined array key "menu" in
wp-content\mu-plugins\polylang\frontend\frontend-nav-menu.php
on line 280
Warning:
Undefined array key "theme_location" in
wp-content\mu-plugins\polylang\frontend\frontend-nav-menu.php
on line 294
Steps to reproduce behavior
No response
Notes
No response
What version of Timber are you using?
2.0
What version of WordPress are you using?
6.4.3
What version of PHP are you using?
8.1
How did you install Timber?
Installed or updated Timber through Composer
The text was updated successfully, but these errors were encountered: