Support

Account

Home Forums Add-ons Repeater Field WordPress 4.8.3 breaks repeater field query

Solved

WordPress 4.8.3 breaks repeater field query

  • Hello –

    Auto update to 4.8.3 has broken some queries based on repeater fields on one of my sites. I have rolled back to 4.8.2 to resolve for the moment, but want to fix it and update ASAP.

    Here is the query code:

    // People Data
    $args = array(
    	'post_type' => 'person',
    	'posts_per_page' => -1,
    	// 'orderby' => 'menu_order',
    	// 'order' => 'ASC',
    	'meta_query' => array(
    		'relation' => 'AND',
    		array(
    			'key'     => 'roles_%_project',
    			// 'compare' => '=',
    			'value'   => $festid,
    		),
    		array(
    			'key'     => 'roles_%_role',
    			// 'compare' => '=',
    			'value'   => 'fellow',
    		)
    	),
    );
    
    $peoplequery = new WP_Query( $args );
    print '<pre>'; print_r($peoplequery->request); print '</pre>';

    Here is the exact request being submitted under 4.8.2:

    SELECT   wp_ngze_posts.* FROM wp_ngze_posts  INNER JOIN wp_ngze_postmeta ON ( wp_ngze_posts.ID = wp_ngze_postmeta.post_id )  INNER JOIN wp_ngze_postmeta AS mt1 ON ( wp_ngze_posts.ID = mt1.post_id ) WHERE 1=1  AND ( 
      ( wp_ngze_postmeta.meta_key LIKE 'roles_%_project' AND wp_ngze_postmeta.meta_value = '13178' ) 
      AND 
      ( mt1.meta_key LIKE 'roles_%_role' AND mt1.meta_value = 'fellow' )
    ) AND wp_ngze_posts.post_type = 'person' AND (wp_ngze_posts.post_status = 'publish' OR wp_ngze_posts.post_status = 'acf-disabled' OR wp_ngze_posts.post_status = 'private') GROUP BY wp_ngze_posts.ID ORDER BY wp_ngze_posts.post_date DESC

    Here’s the exact request under 4.8.3 with the exact same custom code – no changes to my custom theme or any plugins – the only change is to update WP to 4.8.3 from 4.8.2:

    SELECT   wp_ngze_posts.* FROM wp_ngze_posts  INNER JOIN wp_ngze_postmeta ON ( wp_ngze_posts.ID = wp_ngze_postmeta.post_id )  INNER JOIN wp_ngze_postmeta AS mt1 ON ( wp_ngze_posts.ID = mt1.post_id ) WHERE 1=1  AND ( 
      ( wp_ngze_postmeta.meta_key = 'roles_{a55fdb2385e5bc5667d86919f2e54af4db7f6a3e350497f0125f22f5f42d3fa9}_project' AND wp_ngze_postmeta.meta_value = '13178' ) 
      AND 
      ( mt1.meta_key = 'roles_{a55fdb2385e5bc5667d86919f2e54af4db7f6a3e350497f0125f22f5f42d3fa9}_role' AND mt1.meta_value = 'fellow' )
    ) AND wp_ngze_posts.post_type = 'person' AND (wp_ngze_posts.post_status = 'publish' OR wp_ngze_posts.post_status = 'acf-disabled' OR wp_ngze_posts.post_status = 'private') GROUP BY wp_ngze_posts.ID ORDER BY wp_ngze_posts.post_date DESC

    Any help as to what’s going on here?
    Why can’t I use repeater_%_field to query the database anymore?

  • Sorry, I just saw the other issue on this exact topic. Please disregard…

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.