Troubleshooting Common Header Footer Code Manager Issues: Device Display, Code Visibility, and Conflicts
Content
Header Footer Code Manager (HFCM) is a popular WordPress plugin for easily inserting code snippets into your site. However, users sometimes encounter issues where snippets don't behave as expected. Based on community reports, here are the most common problems and how to resolve them.
1. Device Display Settings Not Working
The Problem: A snippet set to load on 'Only Desktop' or 'Only Mobile' appears on all devices, or vice-versa.
Why It Happens: This is one of the most frequently reported issues. The plugin determines the device type using server-side detection. Sometimes, caching plugins or specific server configurations can interfere with this detection. In other cases, as noted in one thread, the issue may be browser-specific (e.g., working in Firefox but not in Chrome).
How to Fix It:
- Clear All Caches: Clear your WordPress cache, any server-level cache (like Varnish), and your browser cache before testing again.
- Test in an Incognito Window: View your site in a browser's incognito or private window to rule out browser cache issues.
- Check for Conflicts: Temporarily deactivate your caching plugin to see if the device display works correctly without it. If it does, you may need to reconfigure your cache settings or exclude the HFCM logic from being cached.
2. Snippet Not Appearing on Specific Pages or Post Types
The Problem: A snippet configured to show on a specific page, post type (e.g., 'recipe'), or WooCommerce shop page does not appear in the page source.
Why It Happens: The conditional logic that determines which pages to display a snippet on can be complex. If there's a mismatch between how the plugin identifies a page and how your theme or another plugin defines it, the snippet may not trigger.
How to Fix It:
- Use 'Specific Pages': Some users have found that the 'Home Page' option under 'Site Display' does not work as expected. A reliable workaround is to use the 'Specific Pages' option and manually select 'Home' from the page list.
- Verify Page ID: Ensure you have selected the correct page or post type in the snippet settings. The plugin uses the internal WordPress IDs for this logic.
- Check for Archive vs. Single: Remember to choose both 'Archive & Posts' if you want a snippet to appear on a custom post type's main archive page and its individual posts.
3. Code Only Works When Logged In
The Problem: A snippet, often a jQuery script, functions correctly when you are logged into WordPress but does not work for logged-out visitors.
Why It Happens: This is almost always caused by a conflict with another plugin or your theme. Many optimization plugins defer or delay the loading of jQuery for guests to improve site speed, which can break scripts that depend on it. This change does not affect the admin area, hence the discrepancy.
How to Fix It:
- Wrap jQuery Code: Ensure your jQuery code is properly wrapped to avoid conflicts:
jQuery(document).ready(function($) { // Your code here }); - Optimization Plugin Settings: Check the settings of any optimization, minification, or deferred JavaScript plugins. Look for options like 'Defer jQuery' or 'Exclude jQuery from deferral' and adjust them accordingly.
- Conflict Test: The most definitive test is to temporarily switch to a default WordPress theme (like Twenty Twenty-Four) and deactivate all other plugins. If the snippet works, reactivate your plugins one by one to identify the culprit.
4. Plugin or Theme Conflicts
The Problem: General erratic behavior, such as code showing in the wrong location, slowing down the admin editor (e.g., Elementor), or snippets not appearing at all.
Why It Happens: HFCM inserts code into your theme's templates. If another plugin or your theme modifies these templates or handles code insertion differently, conflicts can arise. Security plugins like Wordfence may also block script tags from being saved.
How to Fix It:
- Perform a Conflict Test: This is the most critical troubleshooting step.
- Back up your site.
- On a staging site, or during low-traffic hours, temporarily switch your theme to a default WordPress theme (e.g., Twenty Twenty-Four).
- Deactivate all plugins except Header Footer Code Manager.
- Test if the problem persists. If it is resolved, reactivate your plugins one by one to identify which one causes the conflict.
- Check Security Plugins: If you had trouble saving a snippet, check your security plugin's logs for any blocked actions and whitelist the HFCM plugin if necessary.
Conclusion
Many issues with Header Footer Code Manager can be resolved through methodical troubleshooting. Start by clearing your cache, then move on to checking for conflicts with your theme and other plugins. The 'Specific Pages' option is often more reliable than broader categories for displaying code. By understanding these common pitfalls, you can effectively manage your site's custom code with HFCM.
Related Support Threads Support
-
Mobile Only not working correctlyhttps://wordpress.org/support/topic/mobile-only-not-working-correctly/
-
tracker only on dev. sitehttps://wordpress.org/support/topic/tracker-only-on-dev-site/
-
Device has no effecthttps://wordpress.org/support/topic/device-has-no-effect/
-
Still Showing On Mobilehttps://wordpress.org/support/topic/still-showing-on-mobile-3/
-
Disable on mobilehttps://wordpress.org/support/topic/disable-on-mobile-36/
-
Post list loadinghttps://wordpress.org/support/topic/post-list-loading/
-
LiteSpeed Cache issueshttps://wordpress.org/support/topic/litespeed-cache-issues/
-
Scripts showing on some pages but not othershttps://wordpress.org/support/topic/scripts-showing-on-some-pages-but-not-others/
-
Edit code for multiple articles in a categoryhttps://wordpress.org/support/topic/edit-code-for-multiple-articles-in-a-category/
-
Some pages not workinghttps://wordpress.org/support/topic/some-pages-not-working/
-
Code is publically visiblehttps://wordpress.org/support/topic/code-is-publically-visible/
-
Code Changing on Front endhttps://wordpress.org/support/topic/code-changing-on-front-end/
-
Code shows publically above the header of sitehttps://wordpress.org/support/topic/code-shows-publically-above-the-header-of-site/
-
Schema not showing up on pagehttps://wordpress.org/support/topic/schema-not-showing-up-on-page/
-
noscript tags being removedhttps://wordpress.org/support/topic/tags-being-removed/
-
Show only in desktop does not work for ipadhttps://wordpress.org/support/topic/show-only-in-desktop-does-not-work-for-ipad/
-
Persistent Object Cache issue (Redis)https://wordpress.org/support/topic/persistent-object-cache-issue-redis/
-
The word “Header” is showing up on my sitehttps://wordpress.org/support/topic/the-word-header-is-showing-up-on-my-site/
-
Code doesn’t workhttps://wordpress.org/support/topic/code-doesnt-work-5/
-
Deleted code still showinghttps://wordpress.org/support/topic/deleted-code-still-showing/
-
Schema Code isn’t triggering at all on this site alonehttps://wordpress.org/support/topic/schema-code-isnt-triggering-at-all-on-this-site-alone/
-
Result after a form submissionhttps://wordpress.org/support/topic/result-after-a-form-submission/
-
Printed code is different from what I’ve insertedhttps://wordpress.org/support/topic/printed-code-is-different-from-what-ive-inserted/
-
Site Display: Home Page not working, Missing Location: Before/After Contenthttps://wordpress.org/support/topic/site-display-home-page-not-working-missing-location-before-after-content/
-
The search page has an interface errorhttps://wordpress.org/support/topic/the-search-page-has-an-interface-error/
-
Device Displayhttps://wordpress.org/support/topic/device-display/
-
Scripts loading on Blog Index page when it shouldn’thttps://wordpress.org/support/topic/scripts-loading-on-blog-index-page-when-it-shouldnt/
-
Post List shows “…” when selecting Specific Posts in Site Displayhttps://wordpress.org/support/topic/post-list-shows-when-selecting-specific-posts-in-site-display/
-
Schema markup doesn’t appearhttps://wordpress.org/support/topic/schema-markup-doesnt-appear/
-
Code Not Working if Added to Specific Post Typehttps://wordpress.org/support/topic/code-not-working-if-added-to-specific-post-type/
-
Possible conflict with page builder plugin?https://wordpress.org/support/topic/possible-conflict-with-page-builder-plugin/
-
Facebook Pixel Issueshttps://wordpress.org/support/topic/facebook-pixel-issues/
-
Chat bubble snippet not showing up on live sitehttps://wordpress.org/support/topic/chat-bubble-snippet-not-showing-up-on-live-site/
-
Crazy Egg Snippet not adding to sitehttps://wordpress.org/support/topic/crazy-egg-snippet-not-adding-to-site/
-
FAQ showing as ‘hentry’https://wordpress.org/support/topic/faq-showing-as-hentry/
-
Canhttps://wordpress.org/support/topic/can-9/
-
Site Display -> Specific Posts not working?https://wordpress.org/support/topic/site-display-specific-posts-not-working/
-
site wide/Exclude Pages combo not workinghttps://wordpress.org/support/topic/site-wide-exclude-pages-combo-not-working/
-
Pop Up Still Showing On Mobilehttps://wordpress.org/support/topic/pop-up-still-showing-on-mobile/
-
Code added for Mobile only but showing on desktophttps://wordpress.org/support/topic/code-added-for-mobile-only-but-showing-on-desktop/
-
Code running for admins onlyhttps://wordpress.org/support/topic/code-running-for-admins-only/