I was annoyed that WordPress by default just shows 45 most used tags on the Add New Post page and found a solution to display all Tags.

After I create a new post in this blog I usually tag it. WordPress provides a very helpful widget that displays the most used tags, but I want to see all tags that I’ve created in the past. Some research through the net doesn’t bring solutions, so I had to walk through the code on my own. Wasn’t very difficult, it was clear that the tags come with Ajax to the site, and I found the code in wordpress/wp-admin/admin-ajax.php on line 616 (WordPress 3.0.1) or wordpress/wp-admin/includes/ajax-actions.php on line 666 (WordPress 3.6, see comments):

$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );

That is what you’ll carry by JavaScript. To get more tags just change this line to something like this:

$tags = get_terms( $taxonomy, array( 'number' => 999, 'orderby' => 'count', 'order' => 'DESC' ) );

You can also edit wordpress/wp-admin/includes/meta-boxes.php , original is:

<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>">< ?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>

If you change it to:

<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>">< ?php echo $taxonomy->labels->all_items; ?></a></p>

the link to get the tags will be called All Tags, not Choose from the most used tags.

I hope this could help some of you. With the next WordPress update these changes will be lost, but you should be able to do it again and maybe I’ll blog about it ;)

Update for WordPress 3.6

You need to edit:

  • wordpress/wp-admin/includes/ajax-actions.php line 666
  • wordpress/wp-admin/includes/meta-boxes.php

(thanks to Gustavo Barreto)

Update for WordPress 3.8.1

You need to edit:

  • wordpress/wp-admin/includes/ajax-actions.php line 691
  • wordpress/wp-admin/includes/meta-boxes.php line 381

(thanks to August for reminder)

Update for WordPress 3.9.1

You need to edit:

  • wordpress/wp-admin/includes/ajax-actions.php line 702
  • wordpress/wp-admin/includes/meta-boxes.php line 410

Update for WordPress 4.1

You need to edit:

  • wordpress/wp-admin/includes/ajax-actions.php line 836
  • wordpress/wp-admin/includes/meta-boxes.php line 431

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!

7 comments

Gustavo Barreto | Permalink |

It has “moved” in Wordpress 3.6:

File: wp-admin/includes/ajax-actions.php

Line 666 :

$tags = get_terms( $taxonomy, array( 'number' =&gt; 45, 'orderby' =&gt; 'count', 'order' =&gt; 'DESC' ) );

Quite scary number ;)

Galina Toktalieva | Permalink |

It works, thanks.

August | Permalink |

I have been looking for this solution for a long time, and here it is, almost! Do you know where it has “moved” now in 3.8?

Martin Scharm | Permalink |

Thanks for reminding me, August! I just updated the article to include information on where to find the corresponding passages in the latest version of WordPress. Hope that helps :)

August | Permalink |

Hi, thank you very much for your answer. It did’t work for me, but I’ve just found another way to fix it.

Jaan | Permalink |

Hi Martin, thanks so much for this. Is there a way to expand on your method to also do the following: Can it also show empty tags (ie. that are not being used by any posts)? It only shows tags that are used by posts, even if they are in your tags database.

Thanks again Martin.

anonymous | Permalink |

Thanks so much for posting this, Mr Scharm! It really saved me a lot of time, since I am not that faimilar with the WordPress structure yet. In my version, hey aren't at the exact line numbers cited here, but are easy to find with a search for the words.

For a new site where few tags had been used yet, I wanted to see them all, even if unused, and also do not like the "filter bubble" effect of ordering by popularity. I include the parameters to achieve these changes to save someone else the trouble of looking them up:

 `$tags = get_terms( $taxonomy, array( 'number' => 999, 'orderby' => 'name', 'order' => 'DESC' , 'hide_empty'=> false) );`

Cordially, B. Magilavy

Leave a comment

There are multiple options to leave a comment: