S
S
Sergey Mamenko2017-03-20 21:18:37
Google
Sergey Mamenko, 2017-03-20 21:18:37

How to disable indexing of individual pages for attachment wordpress?

There is a page, attachments (pictures) are loaded for it. And these attachments were indexed in Google, getting a separate page each. Can you please tell me how to delete the pages of these attachments and disable their indexing? Is it enough to write in robots.txt a ban on indexing wp-content/uploads?
z2lzMKs.pngzIMQdm7.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vasya Petrov, 2017-03-20
@bobongida97

SEO plugins have a setting - redirect to a post.
This is better than 404.
In general, in order to avoid this, it was not necessary to make links to attachment pages when inserting pictures.

S
Serg_SA, 2017-06-01
@Serg_SA

paste in functions.php

function wph_noindex_for_attachment() {
    if(get_post_mime_type()!= false) {
        echo '<meta name="robots" content="noindex, nofollow" />'.PHP_EOL;
    }
}
add_action('wp_head', 'wph_noindex_for_attachment');

D
Dimonchik, 2017-03-20
@dimonchik2013

delete via google webmaster
prohibit yes, you can uploads, but look at the problem deeper - how did google find them?
Maybe it's the wrong return of the content?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question