我創建使用此功能可按有關文章類型關係:WordPress的wp_set_object_terms SQL錯誤
private function setObjectTerms($last_insert_id){
//INSERT course_type/RELATIONSHIP
wp_set_object_terms($last_insert_id,$this->course_type,'course-type');
}
上面,當然類型可以是「自由」,或「支付」和$ LAST_INSERT_ID只是一個數字..
無論如何,我不斷收到此錯誤,並且不知道爲什麼:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS tr INNER JOIN AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.ob' at line 1]
SELECT tr.term_taxonomy_id FROM AS tr INNER JOIN AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN (15534) AND tt.taxonomy IN ('course-type')
奇怪的是我一直在使用這個相同的功能,並且它的工作。我只是不明白爲什麼產生的SQL不正確。任何人都可以將我指向正確的方向嗎?
感謝answer..I得到你是從,我檢查了我的類WPDB如何初始化來了,它就像這個問題的解決。真的很難過,因爲從不同的班級實施完全相同的功能......我看不出與工人階級和這個人有什麼不同......我想我會睡在它上面 – gray