When I tryed to debug I use
exit( var_dump( $wpdb->last_query ) );
prefer
$wpdb->show_errors();
at the beginning. This help me !
In my case I get $pageTrem used in the request with
get_the_term_list($post->ID,’secteur’);
(secteur is a taxonomy like Restaurant, club, …)
but this return the term name html fomatted and in fact the request was :
... WHERE terms.name = "<a href="https://192.168.192.244/ha/?secteur=restaurant" rel="tag">Restaurant</a>"" ...
I replace by
wp_get_object_terms($post->ID,'secteur');
this function permit to get the term_id more efficient for my request.
Losing time for nothing ??