我拥有自定义帖子类型的所有附件,很好,但现在我还想要自定义术语的附件。
我使用自定义术语“架构”尝试了此查询:
global $wpdb;
$query = "select p1.*
FROM {$wpdb->posts} p1, {$wpdb->posts} p2
WHERE p1.post_parent = p2.ID
AND p1.post_mime_type LIKE 'image%'
AND p2.post_type = 'gallery'
AND {$wpdb->posts}.terms.slug = 'architecture'
AND p2.post_status = 'publish'
ORDER BY p1.post_date DESC";
$attachments = $wpdb->get_results($query);
foreach ($attachments as $attachment) {
}
我做错了什么?
由于