WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Media File URL in which table/field in SQL database? (8 posts)

  1. Michiel
    Member
    Posted 4 years ago #

    Anybody an idea in which table/ field the "File URL" from a media object is stored?

    Also, how is it stored? with full base URL or just everything behind http://www.domain.com/wp-content?

    MANY THANKS! Michiel

  2. webgyrl
    Member
    Posted 4 years ago #

    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.

  3. workingroup
    Member
    Posted 4 years ago #

    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..

  4. Seth Carstens
    Member
    Posted 4 years ago #

    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.

  5. Seth Carstens
    Member
    Posted 4 years ago #

    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.

    Before: sethcarstens.smwpmu.com
    After: sethcarstens.com

    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 "smwpmu.com" 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.

  6. Seth Carstens
    Member
    Posted 4 years ago #

    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.

  7. Mark / t31os
    Moderator
    Posted 4 years ago #

    The file URL you see is generated by a call to the following function.
    http://codex.wordpress.org/Function_Reference/wp_get_attachment_url

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

  8. losimo
    Member
    Posted 3 years ago #

    Hi!

    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, 'http://www.old-domain.com','http://www.new-domain.com');

    Cheers!! :D

Topic Closed

This topic has been closed to new replies.

About this Topic