Created
November 8, 2024 15:15
-
-
Save loorlab/75da53de72815f65b8acac7a7cbf8079 to your computer and use it in GitHub Desktop.
Query - MySQL - WordPress | Total Posts by category
This file contains 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
SELECT | |
COUNT(p.ID) AS total_contenidos | |
FROM | |
wp_posts p | |
JOIN | |
wp_term_relationships tr ON p.ID = tr.object_id | |
JOIN | |
wp_term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id | |
JOIN | |
wp_terms t ON tt.term_id = t.term_id | |
WHERE | |
p.post_status = 'publish' | |
AND p.post_type = 'post' | |
AND tt.taxonomy = 'category' | |
AND t.slug = 'leer-es-mi-cuento'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment