Hi John,
Can you please share more details about your setup so that we try to replicate the issue? This may be related to something specific to your website, I can’t replicate it on my end.
Which version of WordPress are you using and which version of WPCode?
You can also reach out using the form at https://wpcode.com/contact if you want to share more details privately.
To get around this until we figure it out you can deactivate the WPCode Admin Bar Info from the WPCode settings page.
I recently had a similar problem with my own script that required checking that the element actually existed before trying to set a value when using document.querySelector. The problem is that at that location in your code the element does not exist.
Not sure what you want need. This is for a client. The site is running on wordpress.com. I can’t set script debugging on there or I would give you more detail on the line in the code causing the issue.
Theme: Alves
Plugins:
Akismet
Elementor
Elementor Pro
Elementor Header & Footer Builder
Form Vibes
Jetpack
Safe Redirect Manager
Smush
Ultimate Addons for Elementor
WP Rocket
WPCode Light (this plugin I have checked code added using this plugin but none of it affects the admin menu)
Yoast SEO
This error happens both on the front end of the site when logged in and in the admin. The error causes the admin menu at the top of the page to be broken and not work. It also blocks some other scripts from running do to this error.
This error does not happen when not logged into the site
Error from the admin
Uncaught TypeError: document.querySelector(...) is null
/wp-content/plugins/insert-headers-and-footers/build/admin-bar.js?ver=5d377aa89c93914bb91207685348f326
Line/Char: 1:1050
0===wpcode_admin_bar_info_count&&(document.querySelector('#wp-admin-bar=wpcode-loaded-on-this-page .wp-admin-bar-arrow).style.display="none");
The = here should be a -, that’s what I get for typing it out because I couldn’t figure out how to copy from the browser debugger
wp-admin-bar=wpcode-loaded-on-this-page
Hi John,
Thank you for the details. I was asking about your setup because we have not encountered this issue so far so it might be a conflict that is causing it.
As suggested previously, you can disable the admin bar menu from the WPCode Settings page and the script will no longer be loaded if it interferes with your website. I made a note to add an extra check there to prevent this from happening in a future release.