User Interface
Fully control features like search, filtering, selection, sorting, actions, and modifiers with user interface toggles.
Toggling user interface elements
Each set of user interface elements is tied to a specific post type and can be modified in both PHP and Javascript:
// replace {$type} with the post type name
add_filter('index_{$type}_elements', function($elements) {
return $elements;
}, 10);
// replace ${type} with the post type name
wp.hooks.addFilter(
`${type}_elements`,
'index',
function(elements) {
return elements
},
10
)
Available elements
Search bar searchable
Disables search by removing the search bar. Does not remove filters, active filters, or sorting.
Filters filterable
Disables the ability to filter items by removing the filter button and active filters.
Actions actions
Removes all global actions (”Add”, “Trash”, and custom actions). If you are trying to remove specific items, use the options below for “Add” and “Trash”, along with the Action API’s action resource [LINK] for custom actions.
Add New add
Removes the add new button. Note that this does not remove the add/edit page itself and if accessed directly, those will still be accessible for viewers with the correct permissions.
Trash trash
Removes the ability to view the trash. Note that this does not remove the “Delete” modifier. You can remove that (and the edit modifier) using the Action API’s modifier resource [LINK].
Selection selectable
Removes item selection and modifiers. In table views this is the left hand column. In grid views this is the selection component and the select all button at the top. This also removes swipe actions on mobile lists.
View Title title
Removes the view’s title and post type icon.
Example
add_filter('index_post_elements', function($elements) {
unset($elements['filterable'];
return $elements;
}, 10);
wp.hooks.addFilter(
`post_elements`,
'index',
function(elements) {
return elements.filter(function(element) {
return element !== 'filterable';
})
},
10
)