Created
December 21, 2023 22:55
-
-
Save metinsaylan/60180a05bfc0e2ad8d8f39cb06b70dc4 to your computer and use it in GitHub Desktop.
SQL Query to Get WordPress Posts Using Category Name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- SQL Query to Get WordPress Posts Using Category Name | |
select p.id, p.post_title from wp_posts p | |
inner join wp_term_relationships tr on tr.object_id = p.ID | |
inner join wp_terms t on tr.term_taxonomy_id = t.term_id | |
inner join wp_term_taxonomy tt on tt.term_taxonomy_id = t.term_id | |
where post_status ='publish' | |
and tt.taxonomy = 'category' | |
and t.name = 'Featured' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment