我有這個腳本,從一個特定的類別中選擇一個列表:沒有類別中選擇後的wordpress
SELECT wp_posts.*
FROM wp_posts
LEFT JOIN wp_term_relationships
ON wp_posts.ID=wp_term_relationships.object_id
LEFT JOIN wp_term_taxonomy
ON wp_term_taxonomy.term_taxonomy_id = wp_term_relationships.term_taxonomy_id
LEFT JOIN wp_terms
ON wp_terms.term_id = wp_term_taxonomy.term_id
WHERE wp_posts.post_type = 'post'
AND wp_posts.post_status = 'publish'
AND (
wp_term_taxonomy.taxonomy = 'category'
AND wp_term_taxonomy.term_id = wp_terms.term_id
AND wp_terms.name = '$category'
)
如何選擇職位未分類的?我嘗試$category = ''
並得到0行,因爲wp_terms.name =''
沒有字段。
WordPress的DB遵循實體 - 屬性值(EAV)模式,這使得複雜的查詢! – Andomar