Title: Menu doesn&#8217;t activate
Last modified: June 12, 2023

---

# Menu doesn’t activate

 *  Resolved [josflachs](https://wordpress.org/support/users/josflachs/)
 * (@josflachs)
 * [3 years ago](https://wordpress.org/support/topic/menu-doesnt-activate/)
 * Hi, I’m trying to create my first demo but I have trouble getting the menu to
   work, after the installation is complete. It’s there, but I have to manually 
   activate it. How do I to set this automatically?
   I’m using the code in _After
   Import Custom Code Execution_: `$main_menu` `= get_term_by( 'name', 'Main Menu','
   nav_menu'` `);`
 * ‘Main Menu’ I set to main-menu, which is the name of the menu.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [3 years ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16818681)
 * Hi,
 * you are on the right track 🙂
 * I would suggest you to read [our guide here](https://ocdi.com/advanced-integration-guide/#after-import-custom-code-execution)
   and just recheck that all your parameters are correct.
 * Take care!
 *  Thread Starter [josflachs](https://wordpress.org/support/users/josflachs/)
 * (@josflachs)
 * [3 years ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16826016)
 * I read it. Top to bottom, (many, many) more times than I’d like. But I don’t 
   understand it, my lack of php is abysmal. Sorry. 
   My menu is named ‘main-menu’.
   The id is 5. With the settings above the menu is imported. The menu and all the
   items are there. But I have to manually activate it. How do I set ocdi correctly
   with ‘main-menu’ ?
 *  [yahyahaled](https://wordpress.org/support/users/yahyahaled/)
 * (@yahyahaled)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16829283)
 * Hi, Gregor
 * The code you referring does not work with block themes since it uses navigation
   blocks not classic theme menu locations. What to do for navigation blocks by 
   default it assign to the same menu for all pages
 * `set_theme_mod( ``'nav_menu_locations'``, [`
 * `            ``'main-menu'``=> ``$main_menu``->term_id, ``// replace 'main-menu'
   here with the menu location identifier from register_nav_menu() function in your
   theme.`
 * `        ``]`
 * `    );`
 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16840536)
 * Hi [@josflachs](https://wordpress.org/support/users/josflachs/),
 * are you also using a block based theme and have the same issue as [@yahyahaled](https://wordpress.org/support/users/yahyahaled/)
   has mentioned? I just want to make sure the issue is the same for both of you?
 * Do you maybe a have an example of a free block theme with an XML import file 
   I could use to test and debug this issue?
 * Thank you and have a nice day!
 *  Thread Starter [josflachs](https://wordpress.org/support/users/josflachs/)
 * (@josflachs)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16842577)
 * No, I’m working with TinyMCE, Elementor and Hello-Elementor.
 *  [yahyahaled](https://wordpress.org/support/users/yahyahaled/)
 * (@yahyahaled)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16870604)
 * Hi Gregor, 
   Is there any update regarding import issues in navigation blocks 
   for block themes. Still waiting for your update.
 *  Plugin Author [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * (@capuderg)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16929163)
 * Hi,
   we can’t reproduce this issue on our end, so it would be best if you could
   share a free theme and an XML import file that will demonstrate this issue.
 * Once we can reproduce the issue, we can also debug it and fix it (if possible).
   
   Take care!

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Menu doesn’t activate’ is closed to new replies.

 * ![](https://ps.w.org/one-click-demo-import/assets/icon-256x256.png?rev=2506685)
 * [One Click Demo Import](https://wordpress.org/plugins/one-click-demo-import/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/one-click-demo-import/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/one-click-demo-import/)
 * [Active Topics](https://wordpress.org/support/plugin/one-click-demo-import/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/one-click-demo-import/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/one-click-demo-import/reviews/)

## Tags

 * [navigation block](https://wordpress.org/support/topic-tag/navigation-block/)

 * 7 replies
 * 3 participants
 * Last reply from: [Gregor Capuder](https://wordpress.org/support/users/capuderg/)
 * Last activity: [2 years, 10 months ago](https://wordpress.org/support/topic/menu-doesnt-activate/#post-16929163)
 * Status: resolved