How to Disable WP Ghost on Specific Pages in WordPress
October 20, 2023

This tutorial has moved to the new WP Ghost Knowledge Base where each feature is presented in detail.
Exclude specific pages from WP Ghost’s path changes with the built-in Whitelist Paths option, or use the hmwp_process_buffer and hmwp_process_find_replace filters in functions.php for finer control based on page slugs, post types, or custom conditions.
When you need to disable WP Ghost on specific pages
WP Ghost’s path security works site-wide by default, which is exactly what you want for hack prevention. Every page serves assets from your custom paths, and every default WordPress path returns a 404 error.
But sometimes a specific page or path needs to be excluded. A third-party integration that hardcodes WordPress paths, a payment gateway callback URL that expects the original path structure, or a specific landing page served by an external tool can all break if WP Ghost rewrites the paths on that page.
WP Ghost provides two ways to handle this: the built-in Whitelist Paths option (no code, quick setup) and two WP Ghost filters, hmwp_process_buffer and hmwp_process_find_replace (code-based, more flexible).
Method 1 – Use Whitelist Paths (no code)
The simplest way to exclude pages from WP Ghost is to add them to the whitelist. A page that matches a whitelisted path loads with the original WordPress paths.
1. Go to WP Ghost > Firewall > Whitelist. The same fields are also in WP Ghost > Change Paths > Level of Security.
2. Enter the slug or relative URL of the pages you want to exclude. For example, to exclude a page at example.com/sample-page/, add /sample-page/.
3. Click Save.
With Whitelist Options on its default, Show default WordPress paths and allow hidden paths, WP Ghost serves the original WordPress paths on those pages and keeps the custom paths on every other page. Whitelisted paths also skip the firewall, so keep the list short.
You can add multiple paths, one per line. The whitelist matches the beginning of the URL, so adding /shop/ would exclude /shop/ and everything under it (like /shop/my-product/).
This method is recommended for most users because it requires no code, works immediately, and persists through theme and plugin updates.
Method 2 – Use a WP Ghost filter (code)
If you need more control, like disabling WP Ghost based on page template, post type, user role, or other WordPress conditions, use the hmwp_process_buffer and hmwp_process_find_replace filters. They run while the page is built, after WordPress knows which page it is, so conditional tags like is_page() work there. The hmwp_process_init filter runs when WP Ghost loads, before your theme’s functions.php, so it can’t be used for this.
Disable on a specific page by slug
Open your theme’s functions.php file (or a custom plugin file) and add this code:
function my_hmwp_skip_pages( $process ) {
// Conditional tags work only after WordPress has run the query
if ( ! did_action( 'wp' ) ) {
return $process;
}
// Turn off WP Ghost's path changes on one page, by slug
if ( is_page( 'your-page-slug' ) ) {
return false;
}
return $process;
}
add_filter( 'hmwp_process_buffer', 'my_hmwp_skip_pages' );
add_filter( 'hmwp_process_find_replace', 'my_hmwp_skip_pages' );Replace 'your-page-slug' with the slug of the page you want to exclude. You can find the slug in Pages > Edit > URL Slug in your WordPress dashboard.
Disable on multiple pages
To exclude multiple pages, pass an array of slugs:
function my_hmwp_skip_pages( $process ) {
// Conditional tags work only after WordPress has run the query
if ( ! did_action( 'wp' ) ) {
return $process;
}
// Several pages, by slug
if ( is_page( array( 'sample-page', 'contact', 'payment-callback' ) ) ) {
return false;
}
return $process;
}
add_filter( 'hmwp_process_buffer', 'my_hmwp_skip_pages' );
add_filter( 'hmwp_process_find_replace', 'my_hmwp_skip_pages' );Disable on a custom post type
To disable WP Ghost on all pages of a custom post type (for example, a “portfolio” post type):
function my_hmwp_skip_post_type( $process ) {
// Conditional tags work only after WordPress has run the query
if ( ! did_action( 'wp' ) ) {
return $process;
}
// Every single post of the "portfolio" post type
if ( is_singular( 'portfolio' ) ) {
return false;
}
return $process;
}
add_filter( 'hmwp_process_buffer', 'my_hmwp_skip_post_type' );
add_filter( 'hmwp_process_find_replace', 'my_hmwp_skip_post_type' );Disable based on URL path
If you need to match URLs directly (useful for non-page paths like API callbacks):
function my_hmwp_skip_urls( $process ) {
$uri = isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '';
foreach ( array( '/payment-callback/', '/api/webhook/' ) as $path ) {
if ( strpos( $uri, $path ) !== false ) {
return false;
}
}
return $process;
}
add_filter( 'hmwp_process_buffer', 'my_hmwp_skip_urls' );
add_filter( 'hmwp_process_find_replace', 'my_hmwp_skip_urls' );Which method should you use
Use Whitelist Paths (Method 1) when you need to exclude specific URLs and do not need conditional logic. It is the simplest option, requires no code, and works immediately. This is the right choice for most situations like excluding payment callback URLs, third-party integration endpoints, or specific landing pages.
Use the filters (Method 2) when you need to disable WP Ghost based on WordPress conditions like page template, post type, user role, or custom logic that the whitelist can not handle. This gives you full programmatic control but requires adding code to functions.php or a custom plugin.
You can also use both methods together. Whitelist Paths handles the simple URL exclusions, and the filter handles the conditional logic.
Other useful WP Ghost filters
WP Ghost provides additional filters for more granular control over specific features without disabling the entire plugin on a page:
hmwp_process_hide_urls – controls whether WP Ghost hides the default WordPress URLs (the 404 on /wp-admin, /wp-login.php and the old paths) for the current request.
hmwp_process_hide_disable – controls whether the hide and disable features (such as Remove Unsafe Headers and Disable Right-Click) run for the current request.
hmwp_start_buffer – controls whether the PHP output buffer starts at all. Return false to skip all HTML rewriting for the current request.
hmwp_process_buffer – controls whether the buffered HTML is processed for path replacements. Lets you skip rewriting on specific page types without stopping the buffer entirely.
These filters give you fine-grained control over exactly which WP Ghost features run on which pages, without disabling the entire plugin.
Frequently asked questions
Does disabling WP Ghost on a page reduce security for that page?
Yes, partially. On that page, WP Ghost serves assets from the original WordPress paths instead of your custom paths, so bots scanning that URL could identify WordPress fingerprints. With the filters (Method 2), the 2026 Ghost Firewall and Brute Force Protection still apply on that page. With Whitelist Paths (Method 1), the firewall and the reCAPTCHA check are also off for those paths. Only exclude pages when you have a technical reason to do so.
Should I add the code to functions.php or wp-config.php?
Use functions.php for the filters because they rely on WordPress conditional functions like is_page() which are not available in wp-config.php. For a solution that survives theme changes, create a small custom plugin or use a site-specific plugin file instead of functions.php.
Will the Whitelist Paths option also bypass the firewall on those pages?
Yes. A whitelisted path skips the firewall and the threat log, and the brute force reCAPTCHA check is off on it, whichever Whitelist Options level you choose. That’s why the list should hold only the pages that need it. If you only need the original paths on a page and want the firewall to keep checking it, use the filters from Method 2.
Can I whitelist a WooCommerce checkout page?
You can, but it should not be necessary. Only whitelist the checkout page if a specific payment gateway integration requires the original WordPress paths. Test the checkout before and after.
Does WP Ghost modify WordPress core files?
No. WP Ghost uses server rewrite rules and WordPress hooks. No core files are moved, renamed, or modified. Deactivating the plugin restores all default paths instantly.