Created
March 21, 2024 00:58
-
-
Save bookchiq/8263476137fb41ecba66c56952ccdca2 to your computer and use it in GitHub Desktop.
Find duplicate, empty, non-Beaver Builder WordPress pages
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 wp1.ID, wp1.post_title, wp1.post_parent, parent_post.post_title AS parent_post_title | |
FROM `wp_posts` AS wp1 | |
INNER JOIN `wp_posts` AS wp2 ON wp1.post_title = wp2.post_title AND wp1.ID != wp2.ID | |
LEFT JOIN `wp_posts` AS parent_post ON wp1.post_parent = parent_post.ID | |
WHERE wp1.post_type = "page" | |
AND wp1.post_status != "trash" | |
AND wp1.ID NOT IN ( | |
SELECT DISTINCT post_id | |
FROM `wp_postmeta` | |
WHERE meta_key = "_fl_builder_draft" OR meta_key = "_fl_builder_data" | |
) | |
AND wp1.post_content = "" | |
GROUP BY wp1.ID | |
ORDER BY `wp1`.`post_parent` ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment