Theme error in console with multiple themes

frontend.min.js is part of hat plugin or theme?

It’s part of the theme.

Which theme? I dont see it in the ‘twenty twentyone’ theme

Ahh, you’re absolutely right. I’m mixing up the Astra and the Twenty Twenty One themes here. Under the Twenty Twenty One theme I get:

Uncaught TypeError: Cannot read property ‘querySelectorAll’ of null
at new navMenu (primary-navigation.js?ver=1.1:170)
at primary-navigation.js?ver=1.1:182

It points to

The error points to this line in that file:

document.getElementById( 'site-navigation' ).querySelectorAll( '.menu-wrapper > .menu-item-has-children' ).forEach( function( li )

where getElementById is null.

Under the Astra theme, I get:

Uncaught TypeError: Cannot read property ‘querySelector’ of null
at n (frontend.min.js?ver=3.0.2:1)
at frontend.min.js?ver=3.0.2:1

It points to, line:

if(void 0===e){if(!(d=i.querySelector("#ast-mobile-header")))return;

where querySelector is null.

  • This reply was modified 5 days, 10 hours ago by nickk40.

Can you share the URL of your website? Its very hard to figure out whats happening without actually looking at the site

Out of curiosity, have you assigned a menu to the location “Primary Menu” (WP Admin => Appearances => Menu)?

I understand sharing the website link would make it easier to solve, but unfortunately I can’t do that.

Under Appearances > Menu, I have indeed build a menu (with items as well as sub items) that is assigned to both “Primary Menu” and to “Mobile Menu”.

I had only tested it with the free Astra theme and the Twenty Twenty One theme, both of which generated a different, but similar, error. Now also trying the Twenty Twenty, the error is gone. Any ideas how to solve this, especially under the Astra theme, are appreciated.

I reported the error to the Astra support team, and the latest update of the team has solved the error 🙂

Source link