I am still not sure how you call the menu or what $args you supply for the menu. But could suggest you some way to figure it out.
first test: return an empty array, if menu becomes empty, the filter is running,
if not, then your filter is not running and need to find another way
function wpse31748_exclude_menu_items( $items, $menu, $args ) {
return [];
}
add_filter( 'wp_get_nav_menu_items', 'wpse31748_exclude_menu_items', null, 3 );
assume the filter is running, then probably your test logic have problem
function wpse31748_exclude_menu_items( $items, $menu, $args ) {
// Iterate over the items to search and destroy
$found_key = null;
foreach ( $items as $key => $item ) {
if ( $item->object_id == 6927 ) {
// unset( $items[$key] ); // unset a iterating array is not a good idea and may lead to bug sometimes
$found_key = $key; // handle it later.
}
}
var_dump($found_key); // make sure you find something
var_dump($items); // to compare before and after removal if it found something
unset( $items[$found_key] );
var_dump($items);
return $items;
}
add_filter( 'wp_get_nav_menu_items', 'wpse31748_exclude_menu_items', null, 3 );