How to Disable Hide My WP Ghost on Specific Pages
October 20, 2023
First, install and activated the Hide My WP Ghost plugin. Then, follow these solutions:
Using Settings:
- Access Hide My WP Ghost Settings:
- From the left-hand sidebar, go to Hide My WP > Change Paths > Whitelist Options.
- Add the URLs of the Specific Pages:
- Enter the slug or relative URL of the pages where you want to disable Hide My WP Ghost.
(e.g., if you wish to exclude “sample-page”, you would add “/sample-page/”). - Click ‘Save Settings’ once done.
- Enter the slug or relative URL of the pages where you want to disable Hide My WP Ghost.
That’s the general method to exclude specific pages from being affected by Hide My WP Ghost. However, if you want more flexibility and control, you can use the add_filter
function in your theme’s functions.php
file or a custom plugin.
Using add_filter
to Disable Hide My WP Ghost:
- Access Your Theme’s
functions.php
File:- From your WordPress Dashboard, navigate to Appearance > Theme Editor.
- Find and click on the
functions.php
file in the right-hand column.
- Add the Custom Filter:
- At the end of the file, paste the following code:
function disable_hmwp_on_specific_pages($process) {
// Check if we're viewing a specific page by its slug
if (is_page('your-page-slug')) {
return false;
}
return $process;
}
add_filter('hmwp_process_init', 'disable_hmwp_on_specific_pages');
- Modify the Code:
- Replace
'your-page-slug'
with the slug of the page where you want to disable Hide My WP Ghost. - If you have multiple pages, you can add additional conditions.
- Replace
- Save Changes:
- Click ‘Update File’ to save the changes you’ve made to
functions.php
.
- Click ‘Update File’ to save the changes you’ve made to
With that, Hide My WP Ghost should be disabled on the specific pages you’ve chosen.
Remember to always back up your website before making any code changes, and test your site afterward to ensure everything works as expected.