array(3) {
["relation"]=>
string(3) "AND"
[0]=>
array(3) {
["taxonomy"]=>
string(13) "source_domain"
["field"]=>
string(4) "slug"
["terms"]=>
string(17) "insidetechie-blog"
}
[1]=>
array(3) {
["taxonomy"]=>
string(16) "source_subdomain"
["field"]=>
string(4) "slug"
["terms"]=>
string(2) "cn"
}
}
domain = insidetechie-blog
subdomain = cn
Array
(
[0] => 1
[1] => 17
[2] => 19
[3] => 20
[4] => 21
[5] => 160
[6] => 209
[7] => 3540
[8] => 25
[9] => 24
[10] => 25373
[11] => 8017
[12] => 8015
)
SELECT DISTINCT tt.term_id FROM wp_posts p
INNER JOIN wp_term_relationships tr_target ON tr_target.object_id = p.ID
INNER JOIN wp_term_taxonomy tt
ON tt.term_taxonomy_id = tr_target.term_taxonomy_id AND tt.taxonomy = 'category'
INNER JOIN wp_term_relationships tr_domain ON tr_domain.object_id = p.ID
INNER JOIN wp_term_taxonomy tt_domain ON tt_domain.term_taxonomy_id = tr_domain.term_taxonomy_id
INNER JOIN wp_terms t_domain ON t_domain.term_id = tt_domain.term_id
WHERE
p.post_status='publish'
AND p.post_type IN ('post','forum','topic','reply')
AND tt_domain.taxonomy='source_domain'
AND t_domain.slug='insidetechie-blog'
AND EXISTS (
SELECT 1 FROM wp_term_relationships trs
INNER JOIN wp_term_taxonomy tts ON tts.term_taxonomy_id = trs.term_taxonomy_id
INNER JOIN wp_terms ts ON ts.term_id = tts.term_id WHERE trs.object_id = p.ID AND tts.taxonomy='source_subdomain' AND ts.slug='cn'
)