Created
September 29, 2016 02:02
-
-
Save joelstransky/3bdda71f072755e3d8aeac42c3c90d8e to your computer and use it in GitHub Desktop.
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
USE development; | |
SELECT wp_posts.ID FROM wp_posts | |
INNER JOIN | |
wp_term_relationships ON wp_posts.ID = wp_term_relationships.object_id | |
INNER JOIN | |
wp_term_taxonomy ON (wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id) | |
INNER JOIN | |
wp_terms ON (wp_terms.term_id = wp_term_taxonomy.term_id) | |
WHERE 1=1 AND ( | |
( | |
(wp_posts.post_title LIKE '%redirect%') OR (wp_posts.post_excerpt LIKE '%redirect%') OR (wp_posts.post_content LIKE '%redirect%') | |
) | |
) AND wp_posts.post_type = 'document_cpt' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'acf-disabled' OR wp_posts.post_status = 'private') OR | |
( | |
wp_term_taxonomy.taxonomy = 'document_tags' | |
AND | |
wp_terms.name LIKE '%redirect%' | |
) GROUP BY wp_posts.ID ORDER BY wp_posts.post_title LIKE '%redirect%' DESC, wp_posts.post_date DESC LIMIT 0, 20; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment