I am planning to use External Media Without Import plugin which, like any existing media, uses the guid column of the post table to store the URL of the media (ex: jpg etc). My DB has this column defined as VARCHAR(255) which is not enough for some HTTP URLs.

Any drawback in increasing to VARCHAR(2048)? Any alternative to make this work without altering the DB?

Note: as pointed by Tom below, this is a really a limitation of that plugin which should use some other means of storing the external URL...

  • Note that if you achieve this, WordPress will undo the change when the next core schema update happens, usually when updating WordPress. The plugin you mention doesn't need to use the GUID to store the data. You should contact their support as the inability to store long URLs is a bug in the plugin, 3rd party plugin dev support is off topic here and not in this stacks scope – Tom J Nowell Apr 12 at 14:14

No, it is not safe to resize columns in WP core tables, or to alter them.

When you next update WordPress, the update process will alter the tables to the official table schema, truncating all your GUIDs and breaking them.

Instead, you need to contact the support route for the plugin so that they can fix this. They shouldn't be reusing GUIDs to store URLs if the URLs are going to be long. This is a bug in the plugin.

Edit: There's a ticket on Core Trac related to this, reproducing and posting that you can replicate it and it affects you will help, as will watching/starring it https://core.trac.wordpress.org/ticket/47296

| improve this answer | |
  • OK thanks. As for the "bug" in the plugin, I noticed that wordpress itself is storing image URLs in GUID column when adding a media file. Why would it be a bug in the plugin? Is it expected that no image media path is longer than 255 chars!? – Bruno Apr 12 at 15:51
  • 1
    WordPress doesn't get the URL from the GUID. Instead, the GUID gets its iniital value from the URL. The guid is just a unique identifier, the post URL just happens to be what WP fills it with. Case in point, if I migrate my site and change the URL, but leave the GUIDs untouched, the post URLs still work. You could even change the GUID to "bananas" and the URLs would be unaffected, otherwise every time you change the permalinks the GUIDs of the entire database would need to be changed – Tom J Nowell Apr 12 at 19:16
  • My bad, you are right about WP not using the GUID. And that particular plugin is indeed wrongly using the GUID column as the final URL. However, what caused my issue to being with is still a bug/limitation in WP which uses the full URL as the GUID for media. If that is > 255, it fails to import without any message instead of creating a kind of hashed GUID. That problem still exists in 5.3.2 with really long imported filenames. – Bruno Apr 12 at 22:11
  • I'm unfamiliar with that issue, if there's a bug in the WP importer you should report that on the official WP Trac so it can get fixed. If WP's GUID column needs to be longer to fix bugs in core, then it should be fixed in core – Tom J Nowell Apr 12 at 22:25
  • 1
    It has already been filed: core.trac.wordpress.org/ticket/47296 ... and thanks btw! – Bruno Apr 12 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.