WordPress SQL snippets
A place to keep snippets of useful WordPress SQL. Do a select based on some meta field of a post ( i.e. search for a post that has a particular metafieldĀ ) SELECT p.ID,p.post_title, MAX(CASE WHEN pm1.meta_key = ‘id_vim_node’ then pm1.meta_value ELSE NULL END) as field_i_want FROM wp_posts p LEFT JOIN wp_postmeta pm1 ON ( … Read more