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 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.
Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Jan 12, 2015 at 11:41 Robert hueRobert hue 8,5662 gold badges34 silver badges50 bronze badges3 Answers
Reset to default 9I'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';
}
Addition to TheDeadMedic's answer, to show ALL tags:
if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $_POST['action'] ) && $_POST['action'] === 'get-tagcloud' ) {
unset( $args['number'] );
$args['hide_empty'] = 0;
}
return $args;
Just adding some basic relevant info:
When setting a taxonomy setting to 'hierarchical'=>true
it will use the category format side box and will show all terms by default.