Filter wp_nav_menu_objects
. It will contain the sorted list of nav menu items to render. Have a look at wp_setup_nav_menu_item
for some properties you can use.
Here's a quick (untested) example.
add_filter( 'wp_nav_menu_objects', function( array $items, arrayobject $args ) {
if ( 'someThemeLocation' !== $args->theme_location ) {
return $items;
}
return array_filter( $items, function( $item ) {
return '/user-specific-thingy' === $item->url
&& ! is_user_logged_in();
} );
}, 10, 2 );