Show all tags in WP when creating new post
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):
That is what you’ll carry by JavaScript. To get more tags just change this line to something like this:
You can also edit wordpress/wp-admin/includes/meta-boxes.php
, original is:
If you change it to:
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 666wordpress/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 691wordpress/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 702wordpress/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 836wordpress/wp-admin/includes/meta-boxes.php
line 431
Leave a comment
There are multiple options to leave a comment:
- send me an email
- submit a comment through the feedback page (anonymously via TOR)
- Fork this repo at GitHub, add your comment to the _data/comments directory and send me a pull request
- Fill the following form and Staticman will automagically create a pull request for you:
7 comments
It has “moved” in Wordpress 3.6:
File:
wp-admin/includes/ajax-actions.php
Line
666
:$tags = get_terms( $taxonomy, array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
Quite scary number ;)
It works, thanks.
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?
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 :)
Hi, thank you very much for your answer. It did’t work for me, but I’ve just found another way to fix it.
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.
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:
Cordially, B. Magilavy