Hello,
I'm using versions:
Meta Box 5.4.0
Meta Box AIO 1.13.9
and I'm trying to setup a reciprocal relationship between two terms of a custom taxonomy:
MB_Relationships_API::register( [
'id' => 'rbi_neighboring_countries',
'reciprocal' => true,
'from' => [
'object_type' => 'term',
'taxonomy' => 'rbi_country',
'meta_box' => [
'title' => 'Neighboring countries',
],
],
'to' => [
'object_type' => 'term',
'taxonomy' => 'rbi_country',
],
] );
The code on the archive page:
<?php
$terms = get_terms(
array(
'taxonomy' => 'rbi_country',
'hide_empty' => false,
'relationship' => array(
'id' => 'rbi_neighboring_countries',
'to' => get_queried_object()->term_id,
),
)
);
foreach ( $terms as $t ) {
echo esc_html( $t->name );
}
?>
This error is displayed in the frontend:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
mbr_orderASC, mbr_id DESC ASC' at line 1]
SELECT t.*, tt.* , mbr.from AS mbr_from, mbr.to AS mbr_to, mbr.ID AS mbr_id, CASE WHEN mbr.to = t.term_id THEN mbr.order_from WHEN mbr.from = t.term_id THEN mbr.order_to END AS <code>mbr_order</code> FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_mb_relationships AS mbr ON (mbr.type = 'rbi_neighboring_countries' AND ((mbr.from = t.term_id AND mbr.to IN (1)) OR (mbr.to = t.term_id AND mbr.from IN (1)))) WHERE tt.taxonomy IN ('rbi_country') <code>mbr_order</code> ASC, mbr_id DESC ASC
Seems to me like DESC ASC
is the issue?