Change private files attachment order

To sort files by alphabetical order instead of chronological order, you can use this snippet in your theme’s functions.php file. function cuar_change_file_order_on_display($files, $post_id) { uasort($files, function($f1, $f2) { return strcasecmp($f1[‘caption’], $f2[‘caption’]); }); return $files; } add_filter(‘cuar/private-content/files/the-files’, ‘cuar_change_file_order_on_display’, 10, 2);