Skip to content

Instantly share code, notes, and snippets.

@gnuget
Created August 6, 2009 06:48
Show Gist options
  • Save gnuget/163181 to your computer and use it in GitHub Desktop.
Save gnuget/163181 to your computer and use it in GitHub Desktop.
#getting all posts related with a write panel in magicfields
select * from wp_posts where wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') AND 0 < (SELECT count(wp_postmeta.meta_value) FROM wp_postmeta WHERE wp_postmeta.post_id = wp_posts.ID and wp_postmeta.meta_key = '_rc_cwp_write_panel_id' and wp_postmeta.meta_value = '{$write_panel_id}');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment