I'm creating relationships on post types using this funciton:
private function setObjectTerms($last_insert_id){
//INSERT course_type/RELATIONSHIP
wp_set_object_terms($last_insert_id,$this->course_type,'course-type');
}
Above, the course type can be 'free', or 'paid', and the $last_insert_id is just a number..
Anyway I keep getting this error, and have no idea why:
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')
The strange thing is I been using this same function, and it has worked. I just don't get why the SQL produced is incorrect. Can anyone point me in the right direction?