Filter – Admin – Hide sorts for certain users
This filter allow to hide certain sorts for specified users. It control the required capability to show the current sort tab.
Filter name: apto/wp-admin/reorder-interface/sort-view-required-capability
Since 3.6
Paramethers
- $sort_required_capability – the capability being required for the sort to be available for current user
- $sort_ID – the sort ID
Examples
The following code will change the required capability to edit_posts which means a Contributor will be able to se and use the re-order interface.
add_filter('apto/wp-admin/reorder-interface/sort-view-required-capability', 'custom_sort_view_required_capability', 10); function custom_sort_view_required_capability($sort_required_capability, $sort_ID) { global $userdata; //check if current user ID id 10 then hide the sort if ID 52 if($userdata->ID == 10 && $sort_ID == '52') { //assign a capability that current user do not include $sort_required_capability = '_not_included_capability_'; } return $sort_required_capability; }
*This code should be used within the theme or a custom plugin.