# 'Register new menu location' Crashes Wordpress

**URL:** <https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823>\
**Category:** Bug Reports\
**Tags:** bug\
**Created:** [March 15, 2023, 10:31am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823 "2023-03-15T10:31:58Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 15, 2023, 10:31am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/1 "2023-03-15T10:31:58Z")

</div>

Whenever I ‘Register new menu location’ in Pinegrow it crashes Wordpress.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/1/1eb56eabfe29c4c7554aa9e5523c03eaf1f925be.png)

The workaround is to jump into functions.php and remove the generated menu and move it into the register\_nav\_menu array.

---

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 15, 2023, 10:32am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/2 "2023-03-15T10:32:40Z")

</div>

PS, aware the names are the same in the example. It doesn’t matter. Call it what you want.

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [March 15, 2023, 4:13pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/3 "2023-03-15T16:13:11Z")

</div>

Hey, @fakesamgregory! I just tested it in both the WP Plugin and Pinegrow desktop and can’t reproduce the crash.

Menu smart action

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/c/c0ae5f00d85e8c9c2b6e755b4cf8408dd3a08c9b.png)

Generated code in functions.php

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/4/4ed3ac59a2773b002ffa5c7880d54cf6abdc00f4.png)

Menu screen in WordPress 6.1.1

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/b/b53410256435f22fbb760d692a16437dd5dc1312.png)

Unstyled menu added to the theme

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/7/737af5c7cc1d7dd77448ff9b18efee91430b733c.png)

---

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 15, 2023, 4:28pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/4 "2023-03-15T16:28:47Z")

</div>

Thanks. First thing I see is that your functions.php is different from mine. So that’s the issue. You can see mine read.

`register_nav_menu('primary')`

---

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 15, 2023, 4:29pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/5 "2023-03-15T16:29:40Z")

</div>

What happens if you manually change functions.php to

`register_nav_menu('utitily_menu')`

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [March 15, 2023, 4:36pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/6 "2023-03-15T16:36:05Z")

</div>

@fakesamgregory I’m sure it wouldn’t work since it doesn’t have all the [arguments](https://developer.wordpress.org/reference/functions/register_nav_menu/).

For giggles, I double checked another project using Pinegrow Desktop and the function also writes correctly  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/f/f07019cd1445b3754b0c1c2fa40e5b9fdbcd0f0a.png)

What version of Pinegrow are you using? I’ve never seen this issue, and I almost always register menus using the builder.

---

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 15, 2023, 5:23pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/7 "2023-03-15T17:23:50Z")

</div>

I’m using `7.2`. Weird because the website says we’re only on `7.05`. I’m on M1 Mac BTW.

I downloaded `7.05` and got the same issue.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/e/e2d848fbc663dbbbb216a127c9cfe099c008e153.jpeg)

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [March 15, 2023, 5:36pm UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/8 "2023-03-15T17:36:11Z")

</div>

That’s so weird! I also use 7.2 on both M1 macOS and Windows and have never had this issue. Maybe Matjaz or @Emmanuel has some idea why your function is getting written that way?

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [March 16, 2023, 2:04am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/9 "2023-03-16T02:04:59Z")

</div>

@fakesamgregory how about if you set the Description field? Looks like it is required. I’ll add validation.

---

<div class="post-metadata">

**Author:** ![fakesamgregory](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/fakesamgregory/32/3903_2.png) [@fakesamgregory](https://forum.pinegrow.com/u/fakesamgregory)\
**Post date:** [March 16, 2023, 10:36am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/10 "2023-03-16T10:36:06Z")

</div>

This works! Needs to be required.

Awesome

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [March 16, 2023, 11:21am UTC](https://forum.pinegrow.com/t/register-new-menu-location-crashes-wordpress/7823/11 "2023-03-16T11:21:55Z")

</div>

> [@matjaz](#):
>
> I’ll add validation.

This will be the case soon.
