Support

Account

Home Forums Add-ons Flexible Content Field Post order by Flexible Content custom field Reply To: Post order by Flexible Content custom field

  • There isn’t any way within WP to order posts by a flex or repeater sub field.

    The sub fields of these fields are stored using a meta key with that is constructed like this: "{$parent_name}_{$index}_{$sub_field_name}"

    In order to do this you could possibly query the DB directly using $wbdp

    Some parts of the query might look something like this. This is not tested.

    
    SELECT post_id, wp_postmeta.meta_key LIKE "{$parent_name}_{$index}_{$sub_field_name}" AS date ORDERBY date ASC
    

    You could then use the list of returned post ID value and use “post_in” and ‘order_by’ => ‘post__in’