Home Forums Add-ons Repeater Field Order Repeater Field Reply To: Order Repeater Field

  • Hi @jluc73,

    Thanks for the post.

    The first step would involve the creation of a custom filter to replace the standard ‘=’ with ‘LIKE’ in the SQL query, this is to allow for a WILDCARD in the meta_key search.

    The query will look like so:

    // filter
    function my_posts_where( $where ) {
    	$where = str_replace("meta_key = 'dates_%", "meta_key LIKE 'dates_%", $where);
    	return $where;
    add_filter('posts_where', 'my_posts_where');

    You can then order your posts like so:

    $args = array(
    	'numberposts'	=> -1,
    	'post_type'	=> 'post type',
            'orderby'      => 'meta_value'
    	'meta_key'	=> 'telechargement_%_date,
            'order'         => 'ASC'