bom dia, chegou a testar alguma outra solução?
ou quer uma explicação de como otimizar query's?
SELECT ID, post_name, post_update
FROM (
SELECT ID, post_name, post_update, 1 AS sort_order
FROM wp_posts
INNER JOIN wp_term_relationships ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_term_relationships.term_taxonomy_id = '254'
AND wp_posts.post_status = 'publish'
AND wp_posts.ID != '10768'
UNION
SELECT ID, post_name, post_update, 2 AS sort_order
FROM wp_posts
INNER JOIN wp_term_relationships ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_term_relationships.term_taxonomy_id = '112'
AND wp_posts.post_status = 'publish'
AND wp_posts.ID != '10768'
UNION
SELECT ID, post_name, post_update, 3 AS sort_order
FROM wp_posts
INNER JOIN wp_term_relationships ON wp_term_relationships.object_id = wp_posts.ID
WHERE wp_posts.post_status = 'publish'
AND wp_posts.ID != '10768'
AND wp_posts.linguagem != 'en'
) AS subquery
ORDER BY RAND()
LIMIT 8;