This simple query is to retrieve images URL from WordPress gallery using multiple IDs. Quite useful to convert from gallery to individual images in a post.
The short-code of WordPress gallery looks similar as below:
[ gallery type="rectangular" link="file" size="full" ids="7513,7514,7515,7516,7517,7518,7519,7520,7521,7522,7523,7524,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553"]
Copy the IDs without the quotes and paste into the following SQL script:
SELECT * FROM `wp_postmeta` WHERE `post_id` IN (7513,7514,7515,7516,7517,7518,7519,7520,7521,7522,7523,7524,7526,7527,7528,7529,7530,7531,7532,7533,7534,7535,7536,7537,7538,7539,7540,7541,7542,7543,7544,7545,7546,7547,7548,7549,7550,7551,7552,7553) AND `meta_key` = '_wp_attached_file'
The result would be similar to this:
