Quantcast
Channel: WordPress – ScottNellé.com
Viewing all articles
Browse latest Browse all 15

Remove the tag cloud from the taxonomy edit screen

$
0
0

Screen Shot 2016-03-25 at 12.24.45 PM

In the WordPress admin taxonomy edit screen, Tags and any hierarchical custom taxonomies include a tag cloud of “Popular Items” in the left column above the Add Term form. I find this feature useless in most cases, particularly on a large site that may have hundreds of terms in a taxonomy.

Strangely, the official way to disable this tag cloud is to set the popular_items label to null when registering your taxonomy. Indeed, this is the only place the label appears to be used at all. If you’ve registered your own taxonomies and you can override that label in your code, go ahead and do that to clear up the problem. If you have taxonomies registered by a plugin or another method that is outside of your direct control, you can remove it by filtering the taxonomy arguments to unset the label. Here’s how:

/**
 * Remove tag cloud from taxonomy edit screen.
 */
function my_remove_popular_term_cloud( $args ) {
	$args['labels']['popular_items'] = null;
	return $args;
}
add_filter( 'register_taxonomy_args', 'my_remove_popular_term_cloud' );

If you want to target specific taxonomies, you can check which taxonomy you’re working with by passing additional parameters to the filter:

/**
 * Remove tag cloud from taxonomy edit screen.
 */
function my_remove_popular_term_cloud( $args, $taxonomy ) {
	if ( 'post_tag' === $taxonomy ) {
		$args['labels']['popular_items'] = null;
	}
	return $args;
};
add_filter( 'register_taxonomy_args', 'my_remove_popular_term_cloud', 10, 2 );

Now your taxonomy edit screens will be nice and tidy!

The post Remove the tag cloud from the taxonomy edit screen appeared first on Scott Nelle.


Viewing all articles
Browse latest Browse all 15

Trending Articles