Hello,
I think you can use something like this:
Add the following in your function.php file:
add_filter( 'wp_nav_menu_objects', 'my_nav_menu_items' );
function my_nav_menu_items( $items ) {
global $sublanguage;
if ( isset( $sublanguage->current_language->post_name ) && $sublanguage->current_language->post_name == 'en' ) {
return array_filter( $items, 'my_filter_menu_item' );
}
return $items;
}
function my_filter_menu_item( $item ) {
return $item->object_id != get_option( 'page_for_posts' );
}
Thank you, that worked! 🙂
Hello, I would have the same question, but how can hide a certain page or pages. I was using the option, Hide this item for this language, but it will hide it for both languages, English and Albanian. My primary language is Albanian dhe I would like to hide that specific page or pages form the English menu.
Thanks in advance
Hello,
You are right, the hiding incorrectly inherited value from the main language when unselected, which made no sense. I just corrected this. Please download the development version in your plugin directory, then try again and tell me if it works better.
Thank you for pointing this problem!
Hey maximeschoeni, you got it!
It works just fine!
Thanks a lot!