Hide The Old Image Paths with Hide My WP Ghost
October 21, 2021
Before hiding the images with old paths, it’s important to understand what this process entails and what are the risks involved.
Given the fact that images DON’T represent a security risk for your site, hiding them is NOT a necessity, or something we recommend doing to increase protection of your WordPress site.
From an SEO standpoint, if the images have already been indexed by Google, this is what will happen when someone lands on your site via Google Images: they will see a 404 Page Not Found error.
Even if you don’t use Hide My WP Ghost to hide images, over time, Google will index all images with the new paths without affecting SEO.
However, if you still wish to hide the images with the old paths, follow the steps below:
Hide Old Images
Add the following line to your wp-config.php:
define( 'HMW_HIDE_OLD_IMAGES', true );
Once you’ve added this, go to Hide My WP > Change Paths > WP Core Security, and you will see the option to hide Images files in the drop-down under the Hide WordPress Common Paths section (as shown in the screenshot below).
Select the IMAGE files option and Save your settings.
Once you do this, you can go ahead and check using another browser (or by going Incognito) to see if the old images can still be accessed.
Possible errors that might appear as a result of hiding old images
If your theme or other plugins load images into CSS or JS, then it’s possible for images not to load in frontend. A solution for this is using a cache plugin and activating the option to modify the paths in cache files using Hide My WP Ghost.