Plugin Loading Hook

What is the Plugin Loading Hook in WP Ghost?

The Plugin Loading Hook option in WP Ghost is an advanced feature designed to control the initialization process of the WP Ghost plugin.

By default, WP Ghost loads when all other plugins are initialized. However, some specific configurations or caching plugins may require adjustments to ensure WP Ghost functions properly.

This feature forces WP Ghost to load at a specific stage during WordPress execution, ensuring compatibility with certain caching mechanisms and third-party tools.

When to Use the Plugin Loading Hook?

The Plugin Loading Hook option is particularly useful in the following scenarios:

  • Caching Plugin Compatibility: Some cache plugins process frontend content differently, preventing WP Ghost from modifying paths effectively. Enabling this option can resolve such issues if WP Ghost is unable to change paths or obfuscate URLs.
  • ManageWP Plugin Users: If you use the ManageWP plugin for managing WordPress sites, activating the Must Use Plugin Loading option ensures seamless integration and avoids conflicts.
  • Custom Cache Configurations: For setups with custom cache configurations that modify the plugins’ loading order, forcing WP Ghost to load earlier or later may be necessary to avoid path rewriting issues.

Supported Cache Plugins

WP Ghost is already optimized to work automatically with most popular caching plugins, including:

  • WP-Rocket
  • Autoptimize
  • CDN Enabler
  • Breeze
  • Cache-Enabler
  • Comet Cache
  • Hummingbird
  • Hyper Cache
  • LiteSpeed Cache
  • Powered Cache
  • W3 Total Cache
  • WP Super Cache
  • WP Fastest Cache
  • Siteground Optimizer

If you’re using any of these plugins, WP Ghost should work without additional configuration. However, enabling the Plugin Loading Hook may still be necessary in rare cases with custom cache setups.

How to Use the Plugin Loading Hook in WP Ghost

Loading Hook Options

  • Load As Must Use Plugin: Plugin loads as Must Use Plugin in the wp-content/mu-plugins directory.
  • Priority Loading: Plugin buffer starts before other WordPress plugins.
  • Normal Loading: Plugin buffer starts on init hook with 10 priority.
  • Late Loading: plugin buffer starts on template_redirect with PHP_MAX_INT priority.

Plugin Loading Hook

  1. Go to WP Ghost > Advanced > Compatibility.
  2. Select from Plugin Loading Hook when to load the plugin in WordPress. By default is Normal Loading and loads on frontend “init” action.
  3. Click the Save button to apply the changes.
Plugin Loading Hook

Conclusion

The Plugin Loading Hook option is a powerful tool for resolving compatibility issues with cache plugins and third-party tools. While WP Ghost works out-of-the-box with most popular caching solutions, this feature provides additional flexibility when dealing with custom setups or edge cases. Always test changes on a staging site before applying them to your live site to ensure smooth functionality.