Created
January 20, 2025 08:35
-
-
Save loorlab/d474cde0ecd72663803570c60c28eca1 to your computer and use it in GitHub Desktop.
Query - MySQL - WordPress | Total Posts by No Category and Permalinks
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
SELECT | |
p.ID, | |
p.post_title, | |
CONCAT(o.option_value, '/', p.post_name, '/') AS permalink | |
FROM | |
wp_posts p | |
JOIN | |
wp_options o ON o.option_name = 'siteurl' | |
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 | |
AND tt.taxonomy = 'category' | |
JOIN | |
wp_terms t ON tt.term_id = t.term_id | |
WHERE | |
p.post_type = 'post' | |
AND p.post_status = 'publish' | |
AND t.slug = 'sin-categoria' | |
GROUP BY | |
p.ID, p.post_title, p.post_name, o.option_value; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment