Back to Community

Troubleshooting Common Header Footer Code Manager Issues: Device Display, Code Visibility, and Conflicts

41 threads Sep 7, 2025 PluginHeader footer code manager

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.
    1. Back up your site.
    2. On a staging site, or during low-traffic hours, temporarily switch your theme to a default WordPress theme (e.g., Twenty Twenty-Four).
    3. Deactivate all plugins except Header Footer Code Manager.
    4. 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