Support » Fixing WordPress » Media File URL in which table/field in SQL database?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’d like to know this also as I switched my domain and none of my images show and it’s not in the backend settings.

    Webgrl, I explained your issue on your other post.

    Michael, the media files are stored in a directory called includes; the directory structure that you see via http differs, you got to use ftp if you are looking for the file…

    The images and media files are not stored in the SQL database, only the links to them.

    Links to files in the database are stored under options and post, in the GUID section of the table..

    you may want to link to the webgyrl post, as I’m seeking a solution to the problem that I can’t find where its storing the FILE URL for media in the database.

    Ok, I’ve looked for almost an hour. I can’t find anywhere how exactly wordpress is calculating the Media Library -> Edit Media -> File URL.

    I’m trying to move from a subdomain WPMU site to a “domain mapped” site. In this process all my FILE UPLOAD url’s are not changing to the new URL style.


    Everything else moves and changes per my changes to the options table. For the life of me though, I can’t get the File URL of my Media Library to change. I’ve even gone as far to do a MySQL database lookup for “” which it no longer finds. I also already found out the the meta data it stores for the uploads does not include the URL so its just “/blog.dir/18/linkedin.gif” or something similar.

    I parsed through the wordpress codex only to find that the page on “atttachment_url” method is empty…

    WordPress guru’s unite! Help me find out how wordpress is putting together this File URL for the Media Library.

    Lol, nevermind, that was fast.

    I now realize they were hiding in the posts table. I assumed since its meta data, it would be saved as meta data…

    For some reason unknown to me, they are storing the media library path in the wp_post table. Associated with the “attachment.php” theme page. Why store meta data in a post file? Who knows, but I’m glad I finally found it so I can fix my site.

    Also unknown to me is why they do not allow you to edit this information from the media library -> edit image page. And lastly, what is the purpose of storing this link when all the media library file URL’s are already stored as meta data… ugh wordpress sometimes you frustrate me.

    The file URL you see is generated by a call to the following function.

    The function is defined in wp-includes/post.php if you want to take a look at how the URL is built.


    The file URL in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:

    UPDATE wp_posts SET guid = replace(guid, ‘’,’’);

    Cheers!! 😀

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Media File URL in which table/field in SQL database?’ is closed to new replies.