Problems with creating sortable sections in customizer

When you add a new field for customisation, WordPress handles how the values are saved, retrieved, previewed.
Then you don’t have to save the value with a AJAX call.

You just have to add the new field that store orders of sections. Then with JavaScript, you modify the value of this field and use field.trigger("change") to send the change.

You can also use a custom class for this field :
https://developer.wordpress.org/themes/customize-api/customizer-objects/#core-custom-controls

Leave a Comment