Soil warning: nav-walker strpos() empty needle, when empty Custom Link parent menu element

In my nav-menu I have empty parent elements. I created them as Custom Links, but not with ‘#’ but as empty.
Soil gives the following warning:
Warning: strpos(): Empty needle in /public_html/mysite/wp-content/plugins/soil/modules/nav-walker.php on line 49
I don’t want to use # as link, because than the mouse will be pointer, and i found that a bit deceptive. I would like to leave the link empty. What is the good solution?

1 Like

Try amending line 49 to:

$element->is_active = (!empty($element->url) && strpos($this->archive, $element->url));

Please report back if it works.

Yes, it’s solve the problem. Shall I contact with the plugin authors, to make this change official? Otherwise I always need to change it, if the plugin updates…

1 Like

Thanks for reporting back. I’m one of the plugin authors.

1 Like

That’s a nice cheeky fix there Foxaii!

I’d stumbled across this problem a few times and had just written my own quick that I was about to post up in Dicourse - but luckily I’ve found this!

Will this fix be making it’s way into the next version of Soil?

Of course on production I turn off PHP errors but I wouldn’t like my dev sites to start showing errors in the menu.

Is this way of doing “dummy” menu items frowned upon?
It works for me for making dropdown menus or multicolumn footer menus: several dummy parent menu items with their child ones working normally.

It’s been in Soil since September - are you still seeing issues?

1 Like

Says the guy who just tagged 3.6.0 two days ago :eyes:

1 Like

Cheers for that Ben.

To be honest I’m not sure when I downloaded my current soil version so I’ll be sure to check it out on a new download