WP Ghost supports advanced configuration through constants in wp-config.php. These constants let you control plugin behavior at the server level, bypassing the admin interface. They’re useful for locked-down environments, white-labeled deployments, multisite setups, or situations where you want settings that persist regardless of what happens in the WordPress dashboard.

How to Add Constants

Add any of the constants below to your wp-config.php file before the /* That's all, stop editing! Happy publishing. */ comment. Access the file via FTP, cPanel File Manager, or SSH.

HMW_PRIORITY: Force Plugin Priority Loading

define( 'HMW_PRIORITY', true );

Forces WP Ghost to load immediately after WordPress initializes, before other plugins. Use this if you experience compatibility issues with plugins that load before WP Ghost and interfere with its security features.

UI equivalent: WP Ghost > Advanced > Compatibility > Plugin Loading Hook > Priority Loading

wp-config.php showing the HMW_PRIORITY constant set to true
WP Ghost Plugin Loading Hook setting showing Priority Loading option in the admin interface

HMW_RULES_IN_WP_RULES: Add Rewrites in WordPress Rules

define( 'HMW_RULES_IN_WP_RULES', true );

Adds WP Ghost rewrite rules inside the WordPress rewrite rules section in .htaccess instead of adding them as separate rules. Use this when your server blocks the addition of custom rules outside the WordPress section in .htaccess, or as a fallback mechanism.

UI equivalent: WP Ghost > Advanced > Compatibility > Add Rewrites in WordPress Rules Section

wp-config.php showing the HMW_RULES_IN_WP_RULES constant set to true
htaccess file showing WP Ghost rules added inside the WordPress rewrite rules section

HMW_DYNAMIC_FILES: Dynamic Loading of CSS and JS

define( 'HMW_DYNAMIC_FILES', true );

Forces WP Ghost to dynamically load CSS and JS files, including cached files, so that paths are secured even in cached or minified content. Use this when caching plugins or CDN services expose original WordPress paths in cached files.

UI equivalent: WP Ghost > Mapping > Text Mapping > Text Mapping in CSS and JS files including cached files

wp-config.php showing the HMW_DYNAMIC_FILES constant set to true
WP Ghost Text Mapping option for CSS and JS files including cached files

HMW_ALWAYS_CHANGE_PATHS: Rename Paths in Admin

define( 'HMW_ALWAYS_CHANGE_PATHS', true );

Forces WP Ghost to apply path changes inside the WordPress admin dashboard too, not just on the frontend. By default, WP Ghost only changes paths on the frontend to avoid admin issues. Enable this for enhanced privacy where even logged-in admin users see customized paths.

For full admin dashboard customization (parameter names, values, and text), also see the Admin Mapping add-on.

wp-config.php showing the HMW_ALWAYS_CHANGE_PATHS constant set to true
WordPress admin dashboard showing customized paths applied via HMW_ALWAYS_CHANGE_PATHS

HMW_HIDE_OLD_IMAGES: Hide Old Image Paths

define( 'HMW_HIDE_OLD_IMAGES', true );

Blocks access to old image paths after WP Ghost changes the uploads path. Returns a 404 error for common image formats (jpeg, jpg, gif, png, webp, tiff, bmp) accessed through the original path. Useful after migration or path restructuring to prevent bots from accessing old URLs.

After adding this constant, go to WP Ghost > Change Paths > WP Core Security > Hide WordPress Common Paths and select IMAGE Files.

For the full guide, see Hide the Old Image Paths.

wp-config.php showing the HMW_HIDE_OLD_IMAGES constant set to true
WP Ghost Hide WordPress Common Paths showing IMAGE Files option selected
define( 'HMWP_LOGGED_IN_COOKIE', 'hmwp_logged_in_' );

Sets a custom cookie name for logged-in users. This works with custom admin paths to ensure authentication sessions remain valid when the admin path is changed. It also prevents WordPress-specific cookie names from being visible in browser developer tools.

wp-config.php showing the HMWP_LOGGED_IN_COOKIE constant with custom cookie name
Browser developer tools showing the custom cookie name instead of the default WordPress cookie

HMW_FILE_PERMISSION / HMW_DIR_PERMISSION / HMW_CONFIG_PERMISSION

define( 'HMW_FILE_PERMISSION', 0644 );
define( 'HMW_DIR_PERMISSION', 0755 );
define( 'HMW_CONFIG_PERMISSION', 0444 );

Customizes the file, directory, and configuration file permissions that WP Ghost applies when you use the Security Check > Fix Permissions feature. The default values are 0644 for files, 0755 for directories, and 0444 for configuration files (wp-config.php). Use stricter permissions in shared hosting environments or high-security deployments.

wp-config.php showing all three permission constants with default values
WP Ghost Security Check showing the Fix Permissions action button

WP_AUTO_UPDATE_HMWP: Stop Automatic Update Checks

define( 'WP_AUTO_UPDATE_HMWP', false );

Prevents WP Ghost from automatically checking for updates. You can still check for updates manually from Plugins > Installed Plugins > Check for Updates. Use this on staging environments, locked-down production sites, or servers with restricted outbound requests.

For the full guide, see Stop Plugin Auto Update Check.

wp-config.php showing the WP_AUTO_UPDATE_HMWP constant set to false
WordPress Plugins page showing the Check for Updates link for manual update checks

Constants override admin settings. When a constant is defined in wp-config.php, it takes precedence over the corresponding setting in the WP Ghost admin interface. If you set a constant and then try to change the same setting in the UI, the constant value wins. To restore UI control, remove the constant from wp-config.php.

Frequently Asked Questions

When should I use constants instead of the admin UI?

Use constants when you want settings that can’t be changed from the WordPress dashboard (locked-down deployments), when deploying the same settings across multiple sites (white label), when you need settings to persist through plugin resets, or when the admin UI is inaccessible.

Can I use multiple constants at the same time?

Yes. Add as many constants as you need to wp-config.php. Each constant controls an independent feature and they don’t conflict with each other.

How do I remove a constant?

Delete or comment out the define() line in wp-config.php. The corresponding setting reverts to whatever is configured in the WP Ghost admin interface.

Does WP Ghost modify WordPress core files?

No. These constants are added to wp-config.php, which is your site’s configuration file, not a WordPress core file. WP Ghost itself doesn’t modify any core files.

Advanced WP Ghost configuration: