[Resolved] Image URL missing www. in front end display
This thread is resolved. Here is a description of the problem and solution.
Problem:
Custom image fields are being output on the front-end but are missing the www part of the URL.
Solution:
The client had uploaded images on a server where the URL did not use www, then changed the server settings to use www, so the image URLs in wp_posts were missing the www. A plugin to search and replace urls could solve the problem.
This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Strangely, my entries are fine and they use the same basic idea but the image field is called "logo"
Here is an entry: hidden link
The difference is that the ico (the one that doesn't include the www.) is served from a view and the "logo (the one that does include the www.) is served from a content template.
Here is a snippet of the code from the content template:
We have a few reports of problems with image fields since the update, but not this exact one.
Sites running https seems to be a common thread.
Do you only have the production site or do you have another install, e.g. locally, for development that you could test whether this still occurs without https?
If you can't test that yourself I'll need a copy of your site so that we can (hidden link).
Let me mark your next reply as private in case you need to share site details with me.
I was trying to track down why they should be outputting without the www taking for granted that they were added with it.
But when I look at an individual bride post, the images that were added don't include the www, so, no, they won't output it.
In the first screenshot you can see how it looks currently, and in the second you can see what happened when I added the image again, selecting it from the media library. The url correctly includes the www.
I don't know how you added the images in the first place, but that is the problem.
Actually now that I look at it, that still does not solve the problem.
You were looking at the staging site - which actually was non www until I had this issue. Then I converted to www to see if I could figure out what was wrong.
So, you are correct, on the staging site the images were all loaded on the non www version of the site and therefore are all non www in the media browser.
But if you look at the live site - you will see that the urls in the individual bride entries do in fact contain the hidden link.
Here is a screenshot: hidden link
You can also see in the live site media browser that they are listed as hidden link.
Here are some screenshots of the media browser: hidden link hidden link
But still - the www. is not showing in the front end: hidden link
Sorry about the confusion - this is the first time I used a staging site!
Let me know if you want to look at the live site - I couldn't figure out how to make this reply private so I didnt want to send login info.
I spent some time looking at what's actually stored in the database, and I found that the images uploaded to the media library are stored in wp_posts without the www.
When I created a new test bride post and uploaded images they were correctly saved using the www. At some point you must have been using the site without the www, when the bulk of your content was uploaded, and then switched to using www as you are now, without updating the media URLs.