Skip to content

Instantly share code, notes, and snippets.

@greenrobot
Created April 14, 2015 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greenrobot/8feae5738d37231988b2 to your computer and use it in GitHub Desktop.
Save greenrobot/8feae5738d37231988b2 to your computer and use it in GitHub Desktop.
WordPress DB script to update references to uploaded files (pictures)
SELECT meta_value, SUBSTRING(meta_value FROM 9) meta_value FROM `wp_postmeta` where meta_key = '_wp_attached_file' AND meta_value like '2014/%'
# UPDATE wp_postmeta SET meta_value = SUBSTRING(meta_value FROM 9) where meta_key = '_wp_attached_file' AND meta_value like '2014/%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment