WordPress Media Library issue

I am baffled by this one. I went into a live site that I have been working on.

I went to grab an image from the media library via 'normal process' of Add Media and I see all the thumbnail images are blank - just white boxes. I do a little more looking and I see that all the URLs for the images are:

http://media2.mydomain.com/xxxxxxxxx (where xxxxxxxxx is the rest of the address - the domain is shown exactly as it appears 'mydomain' is EXACTLY what comes up)

It should be:

http://ClientURL.com/xxxxxxxxx (where ClientURL would be the real domain name and xxxxxxxxx is the rest of the address)

I have never seen this. The site comes up properly, and images are shown correctly. However, I cannot do any dev work with the images.

No idea what would have caused this and I cannot seem to find where I might be able to change the path in the database.

Any suggestions?

  • Jude
    • DEV MAN

    Hey PTaubman

    Hope all is well with you !

    Looks like the media files are hosted on a separate subdomain to speed up load times for HTTP/1 connections. You can find more data about the folder and the mapping in your wp config file.

    Id reccomend against changing this path in the DB unless you are sure about what you are doing and take multiple backups along the way


  • Andrea
    • The Crimson Coder


    has the site been moved from another host/domain or from another folder?

    this looks like an url search&replace which has gone wrong..

    if not, it could be that there is some custom hook function which is filtering the url of the media library items..
    have a look at your theme's functions.php and see if you find something which seems to involve the media library. :wink:

    in any case this kind of mistake shouldn't come from a professional plugin or theme, it sounds more like the classic mistake coming from someone following a tutorial online..
    so I'd investigate only things which have been custom made by the developer who made the website...

    • PTaubman
      • Recruit


      The functions.php code was fiddled with! In an attempt to 'speed things up' code was added to make it look like it was coming from another subdomain and the default code was left in!

      When I went to look at the file, I saw a recent date associated with it...


      Thanks for the assistance!

  • PTaubman
    • Recruit

    Thanks Andrea -
    The site was originally moved from a dev site, and as far as I know, everything was moved over correctly. I have done this 100s of times. (And I am willing to take the blame if I did mess it up :slight_smile: )

    Thanks for the suggestions - I will take a look.


  • Andrea
    • The Crimson Coder

    Hi Paul,
    I wasn't meant to say that you don't know how to do your work, sorry if it sounded like that.. :slight_frown:

    I just wanted to point out that if someone else have done something which you haven't followed precisely, then it could be related to a migration or to a badly coded hook/filter custom function, and therefore you should eventually look that way.

    edit: while I was writing I've seen that you have found the incriminated piece of code. I'm glad it's sorted now! :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.