Use the WP database (via proper methods) to store a ‘is this the first run’ flag?
Then just conditionally execute.
- check for flag in wp db
- if exist do nothing
- if not exist
- create me my menus dag nammit
- remember to set flag for next round so its only done once
Something like that?
If you need to regenerate then just flip the flag from within the code that decides if the menus need regenerating.
Related Posts:
- Automatically remove trashed pages from nav menu
- add 3rd party link (with script) to menu item
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- How make top level menu item not have link, but have sub-menus that are linked?
- How to Hard Code Custom menu items
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How Does The Walker Class Work?
- WordPress Shortcode in Menu Item Title
- Calling the Menu Title within wp_nav_menu array function
- How to stop mobile theme inheriting desktop navigation menu?
- How to hide an item from a menu to logged out users (without a plugin)
- Large WP 3.0 menu times out and won’t save
- How to apply a class to the second word in menu list item?
- How to switch between the Primary Menus programmatically?
- if role is logged in then do something
- Generate a Menu that displays all child pages of top level parent
- Terms with more than one occurrence have current-menu-item class in menu
- Nav menu items disappearing (but not immediately)
- start_lvl on Walker is not working
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- wp_nav_menu doesn’t generate parent/ancestor classes
- How to add text before WordPress menu item href
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- Remove nav_menus from customizer using a theme
- Pending Custom Link in Menu
- Benefits of using Nav Walker?
- display only the wp_nav_menu, which has the current-menu-item
- Social Links Menu displays icon instead of text (twentyfifteen) [closed]
- Add tabindex to navmenu
- wp_list_pages sort order is different for different languages [closed]
- has_children in custom nav_walker
- I’m having a lot of trouble since upgrade to 3.0.1 with get_page_children() function
- How can I add a link to a WPForms “contact us” form to the main menu?
- How to add wechat (weixin) link to navigation menu?
- Create search form in menu as in Twenty Fourteen theme
- Add link at the end of wp_nav_menu
- Link that refers to a menu item with dynamically generated URL
- WordPress 3.5 dropdown menu
- WP Menu Walker – How to know total depth from inside the start_lvl() method
- How do I add recent posts to the menu?
- Conditional secondary menus
- delete all post with certain meta_keys
- Make nav-menus.php available for editor
- how to add custom wp_nav_menu class css selector to ul and a tags?
- Creating a menu containing categories and authors
- Split into two seperate unordered lists with custom walker
- Can’t add a setting to the “nav_menus” customizer panel
- Use another menu when logged in
- How to remove UL class in wp_nav_menu?
- Displaying menu based on login status
- Use dashicons in menu items?
- Adding an external link to wordpress menu
- Menu separator appearing on next line
- Add a counter beside menu item label
- Why is my array of nav menus returning empty?
- Twenty Fifteen: Change navigation menu behavior
- Need a menu on left sidebar of the page with below requirements [closed]
- How to make top level menu think it has a current item
- Add pages content to startpage through custom menu
- Can you exclude child pages of a specific parent within a navigation?
- Registering a static menu?
- how to change menu titles
- My menu doesn’t fit in the default screen in the mobile version
- How can I remove the navigation menu from a Page that is not on the menu?
- get_nva_menu_locations returns only filled ones
- Add attributes to wrapper html generated by wp_nav_menu
- How To Add color-picker in theme options
- insert an HTML element if there is a submenu only
- How can I click the parent menu then redirect to a special URL?
- Stuck while adding bootstrap navwalker class
- use value returned from shortcode as menu item
- How do I display menu in header without loosing styles?
- Select Menu On A WordPress Page
- How To Add The Help Scout javascript LiveChat from the WordPress menu
- Hiding specific navigation menus from specific roles in admin panel
- How to remove Nav-Menu tooltips? (Wp-Globus plugin)
- Change menu for mobile
- Create a menu item with a blank title
- Navigation bar is on live site but nothing under menu so can’t add in a page
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- WordPress adding Question Mark to URL when using Hashtags in Nav
- Add a data attribute to list item element in menu
- Next page link via the custom menu
- How can I make this custom design menu work in wordpress?
- Active menu item / category
- Add different span class to wp nav menu
- Menu not always using correct link
- Custom Menus and taxonomies
- Help with changing style of the extended menu drop down [closed]
- How we show pages in dropdown
- Menu support for touch devices
- WordPress Flyout Menus
- wp_nav_menu doesn’t show on index page
- Automatically add new posts to a specific menu name
- Elegant way of adding an CTA to a menu
- highlight parent page on menu when child page is on sidebar (and not on menu)
- How to set menu Display location
- How to add custom menu to block theme?
- get menu name for the current displayed page