Support » Fixing WordPress » Google indexing “?attachment_id=” archive pages – Can’t figure out how they’re b

  • I have this strange issue where “?attachment_id=” archive pages are being indexed by Google, and somehow, bypassing Yoast SEO (Premium).

    If I Google “site:automoblog.net inurl:attachment_id” I get 213 results. Here are a few quick examples:

    https://www.automoblog.net/page/26/?attachment_id=yebmnwdpdr
    https://www.automoblog.net/page/35/?attachment_id=vmmtlqhsgsk
    https://www.automoblog.net/page/28/?attachment_id=pejilxku

    When clicking into the pages, They’re typical archive pages (although showing different posts than their non-‘attachment_id’ pages).

    They are also bypassing Yoast, because the titles of the pages are the WordPress title settings (“Site Name | WordPress Title | Page XX”) instead of the Yoast setting (“Site Name – Yoast’s Title Setting”)

    How in the world is this happening? I thought it was a Yoast (or other plugin) issue but I’ve used the Health Check plugin to disable all themes and plugins and it’s still happening, the pages are still there.

    Any help is much appreciated! Thank you.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • I haven”t used yoast in quite some time but there used to be an option to disable/redirect those attachment URLs see – https://www.wpbeginner.com/wp-tutorials/how-to-disable-image-attachment-pages-in-wordpress/

    Thread Starter csburdick

    (@csburdick)

    Already did this, but thanks! The problem is that those pages shouldn’t exist at all; they’re bypassing Yoast somehow.

    @csburdick likely either a theme or plugin is causing those pages to be generated, do those pages exist when you switch to a default theme?

    “Out of the box WordPress does not display archives of attachments. This happens because the ‘has_archive’ option of the attachment post type is set to false. Moreover, while the default post_status parameter of the $query object is set to ‘publish’, the default attachment post_status is set to ‘inherit’. This means that no attachments will be shown in archives unless we explicitly set the query post_status to ‘inherit’ or to ‘any’ (see WP_Query Type Parameters for further information).”

    Thread Starter csburdick

    (@csburdick)

    Thanks for the reply. I set the theme to Twenty Seventeen and deactivated all plugins, and those pages still exist.

    Any idea what else could be causing this or how to fix it?

    Thank you,
    Chris

    Have you tried any plugins to redirect the attachment pages outside of yoast like this one? https://wordpress.org/plugins/attachment-pages-redirect/

    Another option is noindex, nofollow the attachment pages in your robot.txt. This is less ideal as it won’t get rid of them but it will atleast prevent indexing. You could try it using Yoast’s SEO plugin as well by going to Titles & Metas tab and going under Post Types. Check the noindex, nofollow tag for ONLY the attachment post type. Then go to the page and check if its working using something like this – https://sitechecker.pro/robots-tester/

    Thread Starter csburdick

    (@csburdick)

    Yeah all the options in Yoast are set correctly, I’ve checked that about 50 times 🙂

    The problem is something in the WP install itself, and that’s what I’m trying to figure out. It’s strange that the theme and plugins aren’t the culprits here; any idea what in the WP install would be doing this? is it possible that an old plugin altered something in a core file, or some weird htaccess thing?

    Thank you

    Thread Starter csburdick

    (@csburdick)

    Here’s another weird phenomenon.

    The TOC+ widget is set to only display on posts and pages.

    On a normal archive page (https://www.automoblog.net/page/102/), it acts as designed and does not display: https://i.gyazo.com/7120d1c71fa5a9450a4257c8bbd65ee3.png

    But on the weird attachment/archive page (https://www.automoblog.net/page/102/?attachment_id=vmmtlqhsgsk) it does display the headings from the first article in that list: https://i.gyazo.com/a7630344335debab52427e4fc3b78f1b.png

    What it’s doing is using the page/post sidebar, not the home page sidebar as it’s meant to.

    Thread Starter csburdick

    (@csburdick)

    I see others are also having a similar issue but nobody seems to know what the problem is.

    Could we have someone look into it? it’s just only me that’s having this issue.

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Google indexing “?attachment_id=” archive pages – Can’t figure out how they’re b’ is closed to new replies.