Skip to main content

Sort objects by ACF field

If you want your database to be sorted by ACF field, add the code below to MapSVG > Menu > JS > databaseLoaded (replacing the existing code).

Change fieldName string to your own ACF field name.

function(){
var fieldName = 'fieldName'
this.database.getLoaded().sort((objA, objB) => objA.post.acf['fieldName'] > objB.post.acf['fieldName'] ? 1 : -1)
}