• Resolved ominem

    (@ominem)


    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 DISTINCTt.* FROMwp_postsAStLEFT JOINwp_podsrelASrel_chapter_courseONrel_chapter_course.field_id= 675 ANDrel_chapter_course.item_id=t.IDLEFT JOINwp_postsASchapter_courseONchapter_course.ID=rel_chapter_course.related_item_idLEFT JOINwp_postmetaASchapter_course_meta_valueONchapter_course_meta_value.meta_key= 'meta_value' ANDchapter_course_meta_value.post_id=chapter_course.IDWHERE ( (chapter_course.meta_value= "695" ) AND (t.post_type= "chapter" ) AND (t.post_statusIN ( "publish" ) ) ) ORDER BYt.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?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error unknown column only in bidirectional field’ is closed to new replies.