Title: Code running for admins only
Last modified: May 5, 2021

---

# Code running for admins only

 *  Resolved [creativelevity](https://wordpress.org/support/users/creativelevity/)
 * (@creativelevity)
 * [5 years ago](https://wordpress.org/support/topic/code-running-for-admins-only/)
 * I have a simple jquery script in HFCM which I have used for quite a while on 
   many sites. As of this week sometime, on some sites but not others, this code
   only runs when I am logged in to the admin. When I view the site as a visitor
   it does not run. An example of the code I am using in HFCM is:
 *     ```
       <!-- JQUERY SCROLL TRIGGERS -->
       <script >
       	   jQuery(document).ready(function($) {		   
       		   jQuery(document).scroll(function(){
       			//alert ("scrolled");
       			  $('#menu-main').toggleClass('scrolled', $(this).scrollTop() > 50);
        		});
           });
       </script>
       <!-- END JQUERY SCROLL TRIGGERS -->
       ```
   
 * Any thoughts on how I could fix or troubleshoot this further? Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcode-running-for-admins-only%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Thread Starter [creativelevity](https://wordpress.org/support/users/creativelevity/)
 * (@creativelevity)
 * [5 years ago](https://wordpress.org/support/topic/code-running-for-admins-only/#post-14400910)
 * I sorted it. It was a server caching issue with some auto-minify of the HTML.
 *  Plugin Author [99robots](https://wordpress.org/support/users/99robots/)
 * (@99robots)
 * [5 years ago](https://wordpress.org/support/topic/code-running-for-admins-only/#post-14409028)
 * [@creativelevity](https://wordpress.org/support/users/creativelevity/) Good to
   see that the issue is resolved. Please let us know if you need help with anything
   else.

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

The topic ‘Code running for admins only’ is closed to new replies.

 * ![](https://ps.w.org/header-footer-code-manager/assets/icon-256x256.png?rev=2681303)
 * [Header Footer Code Manager](https://wordpress.org/plugins/header-footer-code-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/header-footer-code-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/header-footer-code-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/header-footer-code-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/header-footer-code-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/header-footer-code-manager/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [99robots](https://wordpress.org/support/users/99robots/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/code-running-for-admins-only/#post-14409028)
 * Status: resolved