Issues with custom queries with meta_query on translated pages
-
I have two types of content: panels and speakers. I associate the two with each other using the ACF custom relationship field. I turned off sync for custom fields.
My primary language is English, and the other language is Spanish. I have translations for all panels and all speakers.
When I’m on a panels page in english, it correctly displays all of the associated speakers in their english version.
When I’m on a panels page in spanish, the speakers do not render, but they show up in edit mode correctly.
I’m using custom WP queries and ACF’s functions to show that content. In my custom queries, if I remove the “meta_query” aspect, content appears, but then it’s not correctly filtered.
Anybody else have success with custom queries and/or ACF relationship fields?
Custom Query Example:
$panels = get_posts(array( 'post_type' => 'post', 'meta_query' => array( array( 'key' => 'panel_moderator', 'value' => '"' . get_the_ID(); . '"', 'compare' => 'LIKE' ), ), 'orderby' => array( 'panel_day' => 'ASC', 'panel_order' => 'ASC' ), )); if( $panels ): foreach( $panels as $panel ): echo get_the_title( $panel->ID ); endforeach; endif;
ACF functions Example:
$moderators = get_field('panel_moderator'); if( $moderators ): foreach( $moderators as $moderator ): echo get_the_title( $moderator->ID ); endforeach; endif;
- The topic ‘Issues with custom queries with meta_query on translated pages’ is closed to new replies.