get_nav_menu_with_primary_slug example

if ( ! $classic_nav_menus || is_wp_error( $classic_nav_menus ) ) {
            return null;
        }

        $nav_menu = static::get_nav_menu_at_primary_location();

        if ( $nav_menu ) {
            return $nav_menu;
        }

        $nav_menu = static::get_nav_menu_with_primary_slug( $classic_nav_menus );

        if ( $nav_menu ) {
            return $nav_menu;
        }

        return static::get_most_recently_created_nav_menu( $classic_nav_menus );
    }


    /** * Sorts the classic menus and returns the most recently created one. * * @since 6.3.0 * * @param WP_Term[] $classic_nav_menus Array of classic nav menu term objects. * @return WP_Term The most recently created classic nav menu. */
Home | Imprint | This part of the site doesn't use cookies.