Support

Account

Home Forums Front-end Issues Orderby link array title Reply To: Orderby link array title

  • What type of field is it? A link field?

    A link field stores an array in the database, there isn’t any way to order posts by this type of field.

    Here is an example of 2 link fields in the db:

    
    a:3:{s:5:"title";s:9:"ACF Forum";s:3:"url";s:41:"https://support.advancedcustomfields.com/";s:6:"target";s:0:"";}
    
    
    a:3:{s:5:"title";s:6:"Google";s:3:"url";s:23:"https://www.google.com/";s:6:"target";s:0:"";}
    

    You’ll notice that the first thing that is different and will cause the sorting is
    a:3:{s:5:"title";s:9: compared to a:3:{s:5:"title";s:6

    the 9 and 6 are the string lengths of the titles, so they would be sorted in this order. Also 10 would come before 5. Given two link titles of the same length they would be sorted alphabetically.