Home › Forums › Front-end Issues › Sort posts based on a repeater field "Start_date" › Reply To: Sort posts based on a repeater field "Start_date"
WP will automatically sort posts based on taxonomy/term by using the correct link and instead of creating a custom query to get the posts you use a pre_get_posts filter https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts.
The main problem you’re going to have is sorting the posts by a repeater field. You say that the repeater sub field is sub_seminars_0_start_date
, but if you have multiple repeater rows then you will also have sub_seminars_1_start_date
, sub_seminars_2_start_date
, sub_seminars_3_start_date
, etc. This is where you’re going to have a problem. It is virtually impossible to sort posts based on a repeater sub field value, unless you repeater will only ever have a single row or if you only care about the first row.
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.