menus – Filter ‘wp_nav_menu_objects’ not working

Question

I’m using _s as a starter theme, and trying to use the following filters, but they are not working.

add_filter('wp_nav_menu_objects', 'pp_add_nav_menu_icons', 10, 2);

function pp_add_nav_menu_icons( $items, $args ){
    
    foreach( $items as $item ){

        $item->title="test";
        
    }

    return $items;
}

Interestingly, I have another site where the exact same code is working properly.

Any ideas what could be the issue?

0
lastnoob 1 month 2021-10-20T06:17:38-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse