Error unknown column only in bidirectional field
-
Hi I have a “course” and a “chapter” CPTs with a bidirectional field chapter_course.
With this code I get all element of my CPT “chapter”$params = array( 'limit' => -1, ); $mypod = pods( 'chapter',$params );
But when I add the ‘where’ option to my $params array to get only the chapters from the same course
$params = array( 'limit' => -1, 'where' => 'chapter_course.meta_value = "695"' ); $mypod = pods( 'chapter',$params );
I get this error:
Database Error; SQL: SELECT DISTINCT
t.* FROM
wp_postsAS
tLEFT JOIN
wp_podsrelAS
rel_chapter_courseON
rel_chapter_course.
field_id= 675 AND
rel_chapter_course.
item_id=
t.
IDLEFT JOIN
wp_postsAS
chapter_courseON
chapter_course.
ID=
rel_chapter_course.
related_item_idLEFT JOIN
wp_postmetaAS
chapter_course_meta_valueON
chapter_course_meta_value.
meta_key= 'meta_value' AND
chapter_course_meta_value.
post_id=
chapter_course.
IDWHERE ( (
chapter_course.
meta_value= "695" ) AND (
t.
post_type= "chapter" ) AND (
t.
post_statusIN ( "publish" ) ) ) ORDER BY
t.
menu_order,
t.
post_title,
t.
post_date; Response: Unknown column 'chapter_course.meta_value' in 'where clause'
The weird thing its that when I use the same code but change the fiedl for every other it works perfectly
$params = array( 'limit' => -1, 'where' => 'chapter_description.meta_value = "This is chapter 1"' ); $mypod = pods( 'chapter',$params );
What could be the problem?
- The topic ‘Error unknown column only in bidirectional field’ is closed to new replies.