Skip to content

Instantly share code, notes, and snippets.

@Yelakelly
Created March 2, 2018 21:55
Show Gist options
  • Save Yelakelly/d7b7e79ae27e941ac10d839a767c941e to your computer and use it in GitHub Desktop.
Save Yelakelly/d7b7e79ae27e941ac10d839a767c941e to your computer and use it in GitHub Desktop.
Wordpress - select all acf fields by post category
---- "wp_term_relationships.term_taxonomy_id" - is the id of category
SELECT * FROM wp_term_relationships
LEFT JOIN wp_posts ON wp_posts.id = wp_term_relationships.object_id
LEFT JOIN wp_postmeta ON wp_posts.id = wp_postmeta.post_id
WHERE wp_term_relationships.term_taxonomy_id = 35 AND wp_postmeta.meta_key = 'minimal_hours';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment