Long External Image URLs save but do not appear in Media and so do not have captions, alt text or title text

In some cases, you may try to add image URLs which are too long for WordPress to handle.

Some text gets stripped from some URLs inside wp-db.php

Text gets checked prior to insertion to the database – if the length of the GUID is too long, the image does not get saved to the Media library which prevents adding alt text/captions/titles

An example of an image URL that fails like this is:

https://res.cloudinary.com/teepublic/image/private/s–pDhnP7Va–/t_Resized%20Artwork/c_crop,x_10,y_10/c_fit,w_367/c_crop,g_north_west,h_626,w_470,x_-52,y_-23/g_north_west,u_upload:v1462829024:production:blanks:a59x1cgomgu5lprfjlmi,x_-447,y_-348/b_rgb:eeeeee/c_limit,f_auto,h_630,q_90,w_630/v1537956062/production/designs/3215268_0.jpg

This is 330 characters long which exceeds the limit of 255 characters.

The limit of 255 characters for a GUID/URL is historical and there are actually still many devices which cannot handle URLs greater than 255.

If you experience this issue, you can either use shorter URLs or use a URL shortener to create shorter URLs.

If you do experience this issue, the image will still appear in the post/product/page media editor, and it will still appear on the front end but since we cannot fake the media attachment in the database it means we cannot store any texts such as alt text, caption text or title text for your image.

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo