Hey guys, after some debugging I found out that the object doesn’t contain any property named term_id, so I tried removing the “->term_id” access from the function and now it’s working well! Here’s the modified function:
$saved_menus = self::get_setting( ‘menus’, [] );
if ( is_array( $saved_menus ) && in_array( $args->menu, $saved_menus ) ) {
$items .= ‘<li class=”menu-item wpcas-menu-item menu-item-type-wpcas”><a href=”#”>’ . self::localization( ‘menu’,
esc_html__( ‘Search’, ‘wpc-ajax-search’ ) ) . ‘</a></li>’;
}
return $items;
}