• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Attachment page giving 404 errors

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Attachment page giving 404 errors

This topic is: not resolved

Tagged: 404, attachment, functions.php

  • This topic has 5 replies, 2 voices, and was last updated 12 years, 3 months ago by Brad Dalton.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 20, 2013 at 7:07 am #29671
    myersbr2
    Member

    I moved to Genesis a few weeks ago and everything now looks and functions well.  http://www.stacymakescents.com is the site.  The problem I'm having is that for some reason, when I exported my old WordPress to XML and imported into this installation, now many of the images on my older posts are creating 404 errors.  They were linked to the attachment page (which I now don't do).  I would like to mass redirect anything that goes to an attachment page to the file (image) so all these 404's will go away.  I found some code that is supposed to do this (http://www.wpcloudlayer.com/redirecting-the-attachments-page-to-the-attachment-file/) but it doesn't seem to work for Genesis, I'm sure due to its specialized hooks.  Any help?

    I've already tried disabling all plugins, etc. and that didn't do anything (just wanted to head that suggestion off at the pass).

    The only other thing I would know to do is to re-export the files and then re-import them and hope I could get rid of duplicates...I do NOT even want to try that, as it would be a pain and probably wouldn't work.

    March 20, 2013 at 7:39 am #29675
    Brad Dalton
    Participant

    Still got the old site?

    Install The WP Migrate DB plugin and configure the new server path and domain so all the url's change properly.

    The function for linking images to attachment page or file url are in the wp-admin/options.php files however they shouldn't be edited there.

    There must be a plugin for this or some custom code which i will look for but it sounds like the migration wasn't completed correctly.


    Tutorials for StudioPress Themes.

    March 20, 2013 at 7:53 am #29678
    myersbr2
    Member

    Thanks, Brad, for some input.

    Let me make sure I get this right - Log in to the old site, install the WP Migrate DB plugin and use it to export everything.  That's now done and I have the sql database saved on my local machine.

    Now what?  I'm afraid to try to import that into the new WP install because I've got several new posts and comments since the transition on 3/9, so I'm wondering what happens if I try to import the database (and sadly, I'm not even sure how since I'm a total rookie with databases)?  Won't it overwrite the new tags/categories/posts, etc., etc. I've created?

    March 20, 2013 at 9:07 am #29704
    Brad Dalton
    Participant

    Create a new database using the database wizard in cPanel and import the sql file there.

    You can then change the wp-config connection details using the new db details. If this doesn't fix broken image url's you'll need to use another solution

    There's multiple ways to link your images to the post url or file url rather than attachment post which WordPress generates for all single images uploaded to a post or page. Writing about that at the moment.

    The function included in WordPress SEO by Yoast is the easiest: Redirect Image Attachment URLs to Parent Post


    Tutorials for StudioPress Themes.

    March 20, 2013 at 12:54 pm #29757
    myersbr2
    Member

    Thanks, Brad.  I'm going to try the Yoast SEO option to see if I can get that to work for me.

    March 20, 2013 at 1:19 pm #29767
    Brad Dalton
    Participant

    Yes because that also redirects existing image attachment page URLs to the parent post.

    I thought you may have a problem caused by the migration which broke your image links but seems that's not the case.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble