I am looking for a way to show all post tags on post edit screen/tags sidebox in WordPress admin section. By default WordPress shows 45 most used tags but I need a way to list all tags there or at least increase this limit.
I found similar question here Showing all tags in admin -> edit post. But it suggests to edit/modify WordPress core files which is not what I really want. Because upgrading WordPress will be a huge problem then.
I also could not find anything in Google search. So is there are way to list all or more than 45 tags on post edit page.
I’d say the easiest way to do it is use the get_terms_args
filter and unset the number
limit if the context is right (the AJAX request to get the tag cloud):
function wpse_64058_all_tags ( $args ) {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' )
unset( $args['number'] );
return $args;
}
add_filter( 'get_terms_args', 'wpse_64058_all_tags' );
Note: In the edit box the link will still read “Choose from the most used tags”, even though we’re now displaying all of them.
Edit: As @bonger suggested, you could determine the post type from the referer:
if ( $qs = parse_url( wp_get_referer(), PHP_URL_QUERY ) ) {
parse_str( $qs, $args );
if ( ! empty( $args['post_type'] ) )
$post_type = $args['post_type'];
elseif ( ! empty( $args['post'] ) )
$post_type = get_post_type( $args['post'] );
else
$post_type="post";
}