Display All Tags on Post Edit Page Instead of Frequently Used Tags

How to Display All Tags on Post Edit Page Instead of Frequently Used Tags

in WordPress Admin
Google+ LinkedIn

WordPress by default shows only 45 frequently used tags on post edit page in WordPress admin. In most of the cases it’s quite fine since most of the users do not have that many tags on their blog. But on a relatively large website, you may have hundreds of tags and you may require WordPress to show them all instead of just showing 45 frequently used tags. In this article we will see how we can force WordPress to show all post tags in place of more frequently used tags.

This is quite tricky since the number 45 is hard-coded in WordPress core files. Some solution suggests modifying core WordPress files but in that case, updating WordPress will flush out our customization each time and we will have to reapply the changes again.

The easiest way to accomplish this is to use the get_terms_args filter to modify the AJAX request to get the tag cloud and unset the number limit. Here is the function you can add in your functions.php file to remove number limit.

// display all tags on post edit instead of frequently used tags
function wcs_show_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', 'wcs_show_all_tags' );

Use can modify above function based on your requirements for this specific project.

Share the love

If you like this snippet, share it with others!

Leave a Reply

Your email address will not be published. Required fields are marked *