Support

Account

Home Forums Add-ons Repeater Field Order custom post by sub custom field values Reply To: Order custom post by sub custom field values

  • Hi @priint

    Thanks for the question.

    Just to clarify this concept. It is not possible to sort posts by a custom field value, where each custom field value has multiple values (multiple rows of data in a repeater field).

    This said, it IS possible to sort the data if you only want to use the ‘first’ row from the repeater field. This means that WP has one meta_value per post and can then sort as per usual!

    at the moment, your orderby meta_key query looks like this:

    
    'offres_fournisseurs_%_prix'
    

    All you need to do is construct the exact meta_key which exists in the database. You are extremely close, but need to cahnge the wildcard (%) to 0 to target the first row:

    
    'offres_fournisseurs_0_prix'
    

    Hope htat helps.

    Thanks
    E