Support

Account

Home Forums Add-ons Repeater Field Meta query repeater

Unread

Meta query repeater

  • Hi,

    Im trying to custom a wp_query with a repeater field.
    I tried differents configurations but nothing work. I want to order my query with a repeater field which is a date, and then order it by DESC.

    There is my code :

    function my_posts_where( $where ) {
         $where = str_replace("meta_key = 'date_formation_$", "meta_key LIKE 'date_formation_$%", $where);
         return $where;
    }
    add_filter('posts_where', 'my_posts_where');
    					
    $today = current_time('Ymd');
    $end = '20191212';
    $args = array(
    	'post_type' => 'product',
    	'post_status' =>  'publish',
    	'meta_key' => 'date_formation_$_date_session',
    	'orderby' => 'date_session',
    	'order' => 'DESC',
    	'meta_query'	=> array(
    		'relation'		=> 'AND',
    		array(
    		     'key'=> 'date_formation_$_date_session',
    		     'compare'=> '>=',
    		     'value'	=> '20191108',
    		     'type' => 'DATE'
    		),
    		array(
    			'key'		=> 'date_formation_$_date_session',
    			'compare'	=> '<=',
    			'value'		=> '20191122',
    			'type' => 'DATE'
    	),
    );

    The first function is what I found on the ACF documentation. Im not sure about its utility right now.
    I’m sure it’s something very simple but I don’t find.

    Thank you for your help

Viewing 1 post (of 1 total)

The topic ‘Meta query repeater’ is closed to new replies.