Support

Account

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.