The edit_tags_per_page WordPress PHP filter allows you to modify the number of terms displayed per page for the Tags list table.
Usage
add_filter('edit_tags_per_page', 'my_custom_tags_per_page'); function my_custom_tags_per_page($tags_per_page) { // your custom code here return $tags_per_page; }
Parameters
$tags_per_page int
: Number of tags to be displayed. Default is 20.
More information
See WordPress Developer Resources: edit_tags_per_page
Examples
Change the number of tags per page
To display a custom number of tags per page, simply modify the value of $tags_per_page
.
add_filter('edit_tags_per_page', 'increase_tags_per_page'); function increase_tags_per_page($tags_per_page) { $tags_per_page = 50; return $tags_per_page; }
Display all tags on one page
To display all tags on a single page, set $tags_per_page
to a very high number.
add_filter('edit_tags_per_page', 'display_all_tags'); function display_all_tags($tags_per_page) { $tags_per_page = 10000; return $tags_per_page; }
Display a different number of tags per page for different user roles
Change the number of tags displayed based on the user’s role.
add_filter('edit_tags_per_page', 'custom_tags_per_page_based_on_role'); function custom_tags_per_page_based_on_role($tags_per_page) { $current_user = wp_get_current_user(); if (in_array('administrator', $current_user->roles)) { $tags_per_page = 50; } else { $tags_per_page = 10; } return $tags_per_page; }
Increase the number of tags per page based on a query parameter
Increase the number of tags displayed per page when a specific query parameter is present in the URL.
add_filter('edit_tags_per_page', 'increase_tags_per_page_with_query_param'); function increase_tags_per_page_with_query_param($tags_per_page) { if (isset($_GET['more_tags'])) { $tags_per_page = 50; } return $tags_per_page; }
Decrease the number of tags per page on a specific taxonomy
Display fewer tags per page for a specific taxonomy.
add_filter('edit_tags_per_page', 'decrease_tags_per_page_for_specific_taxonomy'); function decrease_tags_per_page_for_specific_taxonomy($tags_per_page) { global $pagenow, $taxonomy; if ($pagenow == 'edit-tags.php' && $taxonomy == 'my_taxonomy') { $tags_per_page = 10; } return $tags_per_page; }