Only show direct parent and siblings Resolved Requested: 2 years and 3 months ago Hi, I use the Sidebar Page Menu Widget (PRO). Most of the menus work fine, but when I have sub-sub-(sub)-levels all the parent menu-titles are shown. But I only need the direct parent not the others.
OnPoint Plugins 2 years and 3 months ago Hello Philipp, You may remove additional levels of parents and only display the current item’s direct parent by adding the following filter to your active theme’s functions.php file: add_filter( 'advanced-sidebar-menu/menus/page/top-parent', function ( $top ) { if ( is_page() ) { if ( 0 !== (int) get_queried_object()->post_parent ) { return get_queried_object()->post_parent; } return get_queried_object()->ID; } return $top; }, 99 ); Have a great day!
Hello Philipp,
You may remove additional levels of parents and only display the current item’s direct parent by adding the following filter to your active theme’s functions.php file:
Have a great day!
Thanks, that worked fine..