Home › Forums › Add-ons › Repeater Field › How can I query only repeater fields as if they were posts? › Reply To: How can I query only repeater fields as if they were posts?
yes… I was afraid of that. Anyway, I made a following sql query which should return “flat” list of all repeater galleries along with their name and post id to which they belong (for generating links and such on the frontend). So, just for the future reference :
select pm.post_id as post_id , pm2.meta_value as gallery , pm.meta_value as images from wp_postmeta as pm inner join wp_postmeta as pm2 on ((pm.post_id = pm2.post_id) and (pm.meta_key + '_name' = pm2.meta_key)) where pm.meta_key like 'post_photo_galleries_%_post_photo_gallery' and pm2.meta_key like 'post_photo_galleries_%_post_photo_gallery_name';
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.