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'
);
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.