Created
May 13, 2016 01:09
-
-
Save joelstransky/9c161ededf8e2b56ac420990aa8eb169 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
// http://imgur.com/LL2tUqW <- db snapshot | |
SELECT SQL_CALC_FOUND_ROWS 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_term_relationships.term_taxonomy_id IN (5) ) | |
AND ( | |
((wp_posts.post_title LIKE '%melon%') | |
OR (wp_posts.post_excerpt LIKE '%melon%') | |
OR (wp_posts.post_content LIKE '%melon%')) | |
OR ( | |
wp_term_taxonomy.taxonomy = 'document_tags' | |
AND wp_terms.name LIKE '%melon%' | |
) | |
) | |
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' | |
) | |
GROUP BY wp_posts.ID | |
ORDER BY wp_posts.post_title LIKE '%melon%' 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