OR condition doesn’t work anymore in ‘params’ options
-
Hi,
I just updated the Pods plugin to the last 2.8, and now some pages of my website are broken. I get an SQL error.
I created a CPT “maine_coon” to display cats on my website. Each cat have 2 relationship fields to link the cat to his father and his mother (that are also maine coons).
In my functions.php file, I created a function to get kitten from a specific cat (from his ID), with the pods()->find() method.
Here is my code to set the params options (pere = father, mere = mother):
$params = array( 'where'=>'pere.id = '.$parent_id.' OR mere.id = '.$parent_id );
It worked perfectly in 2.7 version of the plugin. Now, with 2.8 version, I get an SQL error :
Database Error; SQL: SELECT DISTINCT
t.* FROM
wp_postsAS
tLEFT JOIN
wp_podsrelAS
rel_pereON
rel_pere.
field_id= 141 AND
rel_pere.
item_id=
t.
IDLEFT JOIN
wp_postsAS
pereON
pere.
ID=
rel_pere.
related_item_idLEFT JOIN
wp_postmetaAS
mere_idON
mere_id.
meta_key= 'ID' AND
mere_id.
post_id=
mere.
IDLEFT JOIN
wp_podsrelAS
rel_mereON
rel_mere.
field_id= 142 AND
rel_mere.
item_id=
t.
IDLEFT JOIN
wp_postsAS
mereON
mere.
ID=
rel_mere.
related_item_idWHERE ( (
pere.
id= 1015 OR
mere.
id= 1015 ) AND (
t.
post_type= 'maine_coon' ) AND (
t.
post_statusIN ( 'publish' ) ) ) ORDER BY
t.
menu_order,
t.
post_title,
t.
post_dateLIMIT 0, 15; Response: Unknown column 'mere.ID' in 'on clause'
I tried to change the params options this way :
$params = array( 'where'=>'mere.id = '.$parent_id );
It worked perfectly. It also worked perfectly with :
$params = array( 'where'=>'pere.id = '.$parent_id );
But with the OR condition, it doesn’t work anymore :/
Can you tell me how I can fix this bug ?
Thx
- The topic ‘OR condition doesn’t work anymore in ‘params’ options’ is closed to new replies.