Filter to modify gallery sort actions

Filter name : rtmedia_gallery_sort_actions

You can use this filter in your theme and can modify the default sorting actions.

rtmedia-sorting-actions

Example 1:
Display these sorting options only to the administrator role.

Add the following code in your theme’s functions.php file:

function hide_rtmedia_gallery_sort_actions( $option ){
  $current_user = wp_get_current_user();
  if( $current_user->roles[0] != 'administrator' ){
    $option = null;
  }
  return $option;
}
add_filter('rtmedia_gallery_sort_actions', 'hide_rtmedia_gallery_sort_actions', 10, 1);

Example 2:
You can also change the default sorting option label or remove additional sorting options for your website.

function change_rtmedia_gallery_sort_actions( $options ) {
    /**
     * Change name of default action
     */
    $options['date_asc'] = 'Ascending date';

    /**
     * Remove default actions
     */
    $options['size_desc'] = null;
    $options['size_asc']  = null;

    return $options;
}
add_filter( 'rtmedia_gallery_sort_actions', 'rtmedia_change_gallery_sort_actions', 10, 1 );