[Resolved] Remove Links to Image Attachment Pages?

Home Forums Support [Resolved] Remove Links to Image Attachment Pages?

Home Forums Support Remove Links to Image Attachment Pages?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1997713
    Michael

    I am in the process of revamping a website. For some reason when I migrated the site to a staging site on WP-engine, it created links for some of the existing images that are pointing to an old url: http://joansbolton.files.wordpress.com

    Here is one of the blog entries on the current site:
    https://santabarbaragardens.com/wp/blog/fall-planting-winter-vegetables/

    And here is the code for one of the images (first image with a caption on the right):
    <div id="attachment_859" style="width: 183px" class="wp-caption alignright"><img aria-describedby="caption-attachment-859" loading="lazy" src="http://joansbolton.files.wordpress.com/2010/10/dscf00011.jpg?w=173" alt="" title="DSCF0001" width="173" height="115" class="size-thumbnail wp-image-859" srcset="https://santabarbaragardens.com/wp/wp-content/uploads/2010/10/dscf00011.jpg 432w, https://santabarbaragardens.com/wp/wp-content/uploads/2010/10/dscf00011-300x200.jpg 300w" sizes="(max-width: 173px) 100vw, 173px" /></a>

    These images do not have a hyperlink that takes you away from the page.

    Here is that same blog entry on the staging site:
    https://mysbgardens2.wpengine.com/blog/fall-planting-winter-vegetables/

    You can see that same image now has a hyperlink:
    http://joansbolton.wordpress.com/2010/10/05/fall-planting-winter-vegetables/dscf0001-2/

    Here the code for that:
    <figure id="attachment_859" aria-describedby="caption-attachment-859" style="width: 163px" class="wp-caption alignright"><a href="http://joansbolton.wordpress.com/2010/10/05/fall-planting-winter-vegetables/dscf0001-2/" rel="attachment wp-att-859"><img loading="lazy" src="http://joansbolton.files.wordpress.com/2010/10/dscf00011.jpg?w=173" alt="" title="DSCF0001" class="size-thumbnail wp-image-859" width="173" height="115"></a>

    That link points to an old site that DOES take you to the old site which we don’t want.

    There are 82 instances of that url in the database. Is there a way to remove those links in the staging site?

    I did find this article:
    https://www.wpbeginner.com/wp-tutorials/how-to-disable-image-attachment-pages-in-wordpress/

    #1997726
    Leo
    Staff
    Customer Support

    Hi Michael,

    This isn’t something the theme can control or interfere with.

    The WPBeginner article you found looks promising. Have you tried it?

    Or maybe a plugin like this would work?
    https://wordpress.org/plugins/velvet-blues-update-urls/

    You can also check with your hosting support to see if they have any suggestions.

    #1997862
    Longinos

    Michael and Leo, excuse me…
    The article is about media attachment pages, not about post content.
    Media attachment pages are created by wordpress with data you can edit in the media library.
    To delete o change the url in the post content you need:

    A) Work whit the database and sql or
    B) A plugin to search text in database fields and delete o change it.
    C) Use phpAdmin

    But take care on this work: Make a database backup before.

    #1997893
    Leo
    Staff
    Customer Support

    Thanks for chiming in!

    #1997894
    Michael

    Thank you both.

    #1998006
    Leo
    Staff
    Customer Support

    No problem 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.