We have a password protected blog, so only users with the password can see the text on the posts - but each image we add to the blog post generate URLs which can then be accessed by anyone who knows the link and listed in Google.

Is there anyway of password protecting certain images in WordPress?

  • Are you hosting your WordPress yourself? If so, you could password protect the folder on your server/using the host login. For STRATO, for example, it's possible to set passwords in the customer login in the security section.
    – TimB
    Commented Jun 6, 2019 at 11:14

1 Answer 1


Password protecting the wp-content maybe not a good idea and may break your site interface. If you want the images are not displayed in google search Create a Robot.txt file in your root directory in hosting and add the code below.

   User-agent: *
   Disallow: /wp-admin/
   Disallow: /wp-content/

  or below if you want to not specific images 

   User-agent: Googlebot-Image
   Disallow: /images/yourImageName.jpg #yourImageName.jpg image for Googlebot 
  1. Or Use this plugin and add below code in Settings>Phpinserter


add_action( 'wp_head', function() {
if ( is_page( 'your_page_name' ) ) {
    echo '<meta name="robots" content="noindex">';
}} );

your specific page will be not index by Google

Or you can pick plugin of your choice from here. It is a preferable method but you have to find some free plugins for content restriction.

Some plugins for restriciting page contents

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.