Title: TypeError: document.querySelector(&#8230;) is null admin-bar.js
Last modified: March 28, 2024

---

# TypeError: document.querySelector(…) is null admin-bar.js

 *  Resolved [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/)
 * Getting this error when logged into the site and it causes other scripts on the
   page to fail
 *     ```wp-block-code
       Uncaught TypeError: document.querySelector(...) is null    <anonymous> .../wp-content/plugins/insert-headers-and-footers/build/admin-bar.js?ver=5d377aa89c93914bb91207685348f326:1    <anonymous> .../wp-content/plugins/insert-headers-and-footers/build/admin-bar.js?ver=5d377aa89c93914bb91207685348f326:1    EventListener.handleEvent* .../wp-content/plugins/insert-headers-and-footers/build/admin-bar.js?ver=5d377aa89c93914bb91207685348f326:1    <anonymous> .../wp-content/plugins/insert-headers-and-footers/build/admin-bar.js?ver=5d377aa89c93914bb91207685348f326:1admin-bar.js:1:1050
       ```
   

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

 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17535416)
 * 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](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.
 *  Thread Starter [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17535747)
 * 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:
   AkismetElementorElementor ProElementor Header & Footer BuilderForm VibesJetpackSafe
   Redirect ManagerSmushUltimate Addons for ElementorWP RocketWPCode Light (this
   plugin I have checked code added using this plugin but none of it affects the
   admin menu)Yoast SEOThis 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
 *     ```wp-block-code
       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");
       ```
   
 *  Thread Starter [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17536104)
 * 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-block-code
       wp-admin-bar=wpcode-loaded-on-this-page
       ```
   
 *  Plugin Author [Mircea Sandu](https://wordpress.org/support/users/gripgrip/)
 * (@gripgrip)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17536220)
 * 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.
 *  Thread Starter [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17537542)
 * Thanks, disabling the feature corrected the issue. That’s good enough for this
   site.

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

The topic ‘TypeError: document.querySelector(…) is null admin-bar.js’ is closed 
to new replies.

 * ![](https://ps.w.org/insert-headers-and-footers/assets/icon-256x256.png?rev=2758516)
 * [WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager](https://wordpress.org/plugins/insert-headers-and-footers/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-headers-and-footers/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-headers-and-footers/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-headers-and-footers/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-headers-and-footers/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [John Huebner](https://wordpress.org/support/users/hube2/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/typeerror-document-queryselector-is-null-admin-bar-js/#post-17537542)
 * Status: resolved