Created
February 11, 2025 00:14
-
-
Save loorlab/1598f19af87a8433430be65dec8afa23 to your computer and use it in GitHub Desktop.
Query - MySQL - WordPress | Display all Posts exclude pages and other content type
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, | |
p.post_status, | |
CONCAT(u.option_value, '/', p.post_name, '/') AS permalink | |
FROM | |
wp_posts p | |
JOIN | |
wp_options u | |
ON u.option_name = 'siteurl' | |
WHERE | |
p.post_type = 'post' | |
AND p.post_status IN ('publish', 'draft', 'pending', 'private') | |
ORDER BY | |
p.post_date DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment