在wordpress中激活主题时,通过functions.php创建一个包含两个新项目的自定义菜单

I am creating a theme in wordpress. I would like to create a custom (primary) menu that is active and "live" with two new items. How can I do this the easiest way in functions.php when activating the theme through admin?

if ( is_admin() && isset($_GET['activated'] ) && $pagenow == 'themes.php' )
{
    //Create new primary menu
    //Create 2 new items
    //Active this menu
}

Honestly, you don't want to go there.

Really, just don't.

In practice, it's very messy to get right, e.g. what happens when the user replaces one of the menus you created with his own, deletes the one you created, and tries a new theme or three before reverting to yours.

Let WP do its thing with the placeholder, with the assumption that the end-user will customize things with his own menu.