Skip to content

Instantly share code, notes, and snippets.

@sowich
Created July 23, 2019 11:34
Show Gist options
  • Save sowich/3a76dabf0ea837669e7deee2a51ca71e to your computer and use it in GitHub Desktop.
Save sowich/3a76dabf0ea837669e7deee2a51ca71e to your computer and use it in GitHub Desktop.
SELECT
wp_posts.ID
FROM
wp_posts
LEFT JOIN
wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
WHERE
1 = 1 AND wp_posts.ID NOT IN (93110)
AND (wp_term_relationships.term_taxonomy_id IN (8))
AND wp_posts.post_type = 'post'
AND ((wp_posts.post_status = 'publish'))
GROUP BY wp_posts.ID
ORDER BY RAND()
LIMIT 0 , 8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment