Question

I'm trying to offload Wordpress images from my web server. I've successfully moved everything over to Amazon AWS and have a syncing mechanism in place that uploads new images to AWS. Now I would like to store a flag somewhere that indicates whether the image has been synced so my custom theme can pick the correct path. I was thinking adding that flag to the wp_postmeta table, as part of the meta_value serialized object.

Is that a safe technique? What are the chances this value gets overwritten and lost?

Additionally, I assume the guid field wp_posts shouldn't be updated with the full path to the image on AWS? That could be a solution as well.

Was it helpful?

Solution

guid doesn't affect the image URL, it is just used as a unique identifier. It could be random gobbledygook and as long as it is unique it wouldn't make a difference. It should be safe to use postmeta as long as you aren't using any plugins that would potentially completely overwrite all postmeta associated with an attachment - no plugins I am familiar with would do so, just mentioning what you would need to check on. Most plugins use update_post_meta which adds or updates if a particular postmeta key is found, so use a unique meta_key and you should be safe.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top