Custom Taxonomies
If you are using WordPress 2.8, might I recommend Simple Taxonomies, which has a few of the features I’ve been waiting for better APIs to implement.
Download Latest Version (1.2.5) Now
WordPress provides a lot of functionality geared towards the use of generic “taxonomies”, such as Tags and Categories, but no way to manage the taxonomies themselves. The Custom Taxonomies WordPress Plugin allows you to:
- Create custom taxonomies with admin-set names and slugs for posts, pages, or links
- Define whether or not to accept hierarchies, descriptions, multiple selections, and/or tag-style entry
- Manage each taxonomy’s terms in a full AJAX-interface
- Assign terms to posts, pages, and links just as you would with categories and tags
- Setup permalinks
- Add widgets for your taxonomies into your site
- NEW: Term Clouds!!
- NEW: Support for single-selection taxonomies!!
Feedback
If you like my plugin please rate it. If you really like it (or have money to burn), please consider supporting further development by donating via PayPal
Changelog
Version 1.2.5 (2/18/10)
- Fixed ability to remove all taxonomies from a post (thanks everyone who reported this, and Angelia for finally getting me to do this)
Version 1.2.4 (2/18/09)
- Added “None” option to single-select dropdown (thanks nick and danf)
Version 1.2.3 (2/5/09)
- Added term clouds!
- Added single-selection dropdown option
- URL parameter fix (thanks Matt)
Version 1.2.2 (1/3/09)
- Basic backwards compatibility (thanks Hikmet)
- Add terms bugfix (thanks Iplingo)
Version 1.2.1 (12/30/08)
- Small fix with global variables (thanks Jorge)
Version 1.2 (12/29/08)
- Added permalinks
- Added ability to edit parts of taxonomies
- DB charset bug fix
Version 1.1 (12/28/08)
- Added widgets
Version 1.0 (12/26/08)
- Initial release
Oh, sorry, i was talking about “Custom Field Taxonomies” plugin, not yours.
I’m on the way to try your plugin.
Other thing – what tag is used to show single post taxonomies, as same as to list categories in the single post with the_category(); tag?
Many thanks.
Here’s a strange issue. Using this with WordPress MU on a blog with an ID greater than 1, it breaks the permalink structure. Basically WordPress can’t find any specific blog posts with this plugin active, as soon as it’s disabled, viola they’re back…
I haven’t done much digging to find out why this is, or if this is isolated only to me, but figured I would send the beacon out and see if others experience this, or if you can duplicate it.
First let me say, I’m unencumbered by knowledge but can usually hack around and figure things out. I’m confounded as to how to style your “term cloud.” The template’s css allows for styling the built in cloud widget but it doesn’t apply to yours. Can you point me in the right direction? Thanks! – Evil
Here are a couple things that I’ve come across.
1) I have created a custom taxonomy called “Company” and added one company called “Test” with a slug of “test”. I added a post and selected the Test Company. Then, I browsed to /company/test and saw our 404.php template.
2) Then I added a second taxonomy with the nested option on. Next I went to this taxonomy manager (/wp-admin/edit.php?page=custax_$term) and added a new item called “A & B” with a parent of None. When I try to add a child to A & B, the item is displayed as “A & B” in the drop-down list. By simply returning back to this taxonomy manager (/wp-admin/edit.php?page=custax_$term), the issue looks to be resolved.
Thank you for your efforts on this plugin.
On #2 above, the “A & B” was displayed as “A & & a m p ; B” with the only spaces after A and before B.
Hi,
This is excellent plugin.
Thanks a lot.
Is widgets of this plugin are compatible of WordPress 2.8. For now I now it isn’t. When it will be?
Please don’t wait for 2.8.
Remove taxanomy BUG at Edit PAGE Page.
Yo, excellent plugin, and exactly what I was thinking I’d have to make myself (and so glad I didn’t!). Setting it up, but your instructions aren’t so clear when it comes to styling taxonomies within the template (other than the widget hints, that is). In index.php, I’ve got a variety of ifs such as “is_category” and “is_author” and so on, but how do I style it for a created taxonomy? I’ve tried “is_term” and “is_taxonomy” and both throw errors. I also tried going by the specific taxonomy names, “is_notice” and “is_warning” etc, and still got errors. What’s the trick? Even adding the taxonomies to includes/taxonomy.php in the core didn’t seem to get WP to recognize the terms so I can set a header for the index. I’m not afraid of PHP, if you could just give me some hints on where I need to start hacking.
Thanks again for your hard work. It’s an awesome plugin, and exactly what I so desperately needed!
Hi,
I was really glad when I discovered this plugin, but it seems that I got a similar problem to Nick’s. Whenever there are more than 2 posts per one term in a taxonomy the archive.php template displays only 2.
Any suggestions? (im pretty desperate, cause I worked for 2 weeks to adapt my site to this plugin,but now it seems as if everything was…well..for nothing)
Thanks,
Mitja
Mitja: I’ll have some free time this week and I’ll take a look at the issue. Hopefully I can get a new release out soon!
great plugin!
will you have time to fix the “multiple selection”?
@Brian
Hi Brian, thanks for the reply. Fortunately I found out the problem, which has nothing to do with your plugin, but my lack of expertise in multiple loops. Great plugin in all views! Sorry again for alarm.
thank you for you.I love WP
Hi,
First of all i want to say that you made a excellent plugin and i love it. but there is a bug in the plugin.
if i export the data through wordpress Import/Export feature it wont export the custom Taxonomies.
Please check this bcoz this is an important feature who want to move their blog and who daily update the blog on localhost and then import all the posts online (like Me)..
Thanks
Hi,
Really thank you for your great plugin ! However, you can tell me how to display the results for static pages in alphabetical order?
Thanks again
Fix the previous message, it is in fact filled show results in reverse order “the A” at the end of a long list. (First in the last page !) Yes ?!!
Thanks
I’ve been searching around for something like this, I love it! Thanks! I was wondering how I’d go about making the taxonomies show up like categories and tags do within a post or page. It’d be for pages if that makes a difference.
I’m sorry. I wasn’t paying attention and found out how to do what I was looking for when I revisited the readme file.
Though now I’m on a new mission. To figure out how to display more than three pages when you click a taxomony from the cloud.
Thank you for the great plugin
but, i found it can’t support i18n, after i added some item in the lang.po / mo , my custom taxonom still display in english. I tried, but can’t found where to add __( ), i think it’s very easy for you, so wish you can add this in ver1.2.5.
There’s a conflict between terms or taxonomies, somewhere. I use MU 2.7.1
I have posts associated to tax/terms and the widget also show the number of posts. The posts are not found both in frontend and dashboard when I click on the number of posts associated to the term.
http://tuscanjewels.com/tjwp/aree-della-toscana/colline-fiorentine/
I have not problems in tuscanjewelsholidays.com which uses WP 2.7.1 (no MU).
Great great great plugin. Really… it really turns WP into a CMS. Hopefully you will find a fix for MU.
Gabriele
Thanks for the plugin, itäs really useful.
I have a bug report: It donät handle revisions well, which is on by default on WP 2.7 The paging on taxonomy pages counts revisions in term_relationships, which breaks the paging.
Thank you, big time!
I have noticed that some of this functionality is implemented in trunk now, but some sweet sexiness such as
list_terms('taxonomy')is still missing. (And with you plugin enabled, something goes weird on me in the Posts menu in the backend.)Will you find the time to upgrade the plugin to be fully compatible with WP2.8?
@Thomas Misund: I haven’t had a chance to look at the 2.8 codebase, but assuming the code requires fewer hacks than 2.7 I may stop developing 2.7 and switch to 2.8. Honestly, I thought that 2.8 would have its own taxonomy management pages, but if not I’ll gladly develop it.
via http://twitter.com/bueltge/status/2098097113
http://yoast.com/wordpress-custom-taxonomies/
http://yoast.com/wordpress/simple-taxonomies/
@Steffen: Thanks, I updated the page to reflect this new plugin.
As far as I understand, the “simple taxonomies” plugin you are suggesting now does not allow to create hierarchical taxonomies (category-like ones), but only the “tag-like” ones. Am I right?
How would I make my old “Custom Taxonomies” grow up and become “Simple Taxonomies”?
I got that issue too – custom taxonomy archive page shows only one or two posts, totally ignoring amount set under settings > reading. I noticed that by accident. Otherwise plugin works fine. Any solutions to that?
I have found some issues with the way the edit.php page presents all the extra taxes;
http://probablepossible.com/images/edit-post-1.jpg
http://probablepossible.com/images/edit-post-2.jpg
I’ve begun clearing up the mess via wp-admin.css, including {display: none;} for the category and the post tags column, which we wont’ be using at all. I would like to use the taxonomy plugs instead of the full name in the display there. how do I change that?
Hi Brian, just wanted to echo John James Jacoby and Gabriele’s concerns about making your plugin fully compatible with WPMU 2.7.1?
Hi Brian,
Sorry for the double post, but I just wanted to come back to an old issue I had.
Is there a way to differentiate your custom taxonomies from WordPress’ categories and/or tags when both have the same name or slug?
This plugin is still useful for those of us on WPMU.
Hi Brian, thanks for this great plugin and for the tip on Simple Taxonomies but your plugin seems to work better with More Fields plugin. I use this to manage post types where you can select the meta boxes to assign to each post type.
Example:
I create custom taxonomies ‘Music Genre’ and I then associate the meta-box to the ‘Albums’ post type. (and exclude it from the other post types)
I do this because the Custom Taxonomies I created are listed in the boxes you can assign while the taxonomies created with simple taxonomies aren’t anywhere to be seen.
I know this is a problem of simple-taxonomies plugin but I just thought I’d drop a line here too. Keep up the good work!
Hi,
I’m not sure your plugin supports this, but since you said you have permalink support, I tried to entet the slug of a taxonomy (“blogs”) I created as a custom permalink structure (like this) -
/%blogs%/%category%/%postname%/
but apparently that doesn’t work. Any idea how I could make this work? Thanks!
Hi again,
I made this work using the scategory plugin and querying for the blog term. Maybe adding a customg rewrite tag for a taxonomy would be a neat additional feature for your cool plugin.
Hi Brian,
Congrats on a really useful plugin – I’m using it on a WPMU install and it’s working fine. One query, though, the same as kaigou’s below:
In archive.php, WP uses to customise archive pages. How can we do this with custom taxonomies? What I want to achieve is showing the taxonomy name at the top of such an archive, so the code I would use is something like:
Except, obviously, I need to know the correct names for is_taxonomy and taxonomy_name. I had a look around in custom-taxonomies.php, and couldn’t find anything that looked like it would work.
If you could help me out, that’d be great.
Cheers,
M
Hi, a very quick question, I’ve tried your plugin under the 2.6.5.
> New taxonomy manager appears well under Manage
> However I don’t see any box in the Write post panel to pick my new taxonomy terms (I’ve created a post taxonomy)
Anything particular to get it working ?
Thx in advance and thx for the plugin.
- Benjamin
Hi there Brian,
I’ve setup a series called ‘Hotels’ and a widget on the bottom right of our site, but when you click a hotel, the two sidebars disappear. We’re using the Atahualpa theme. Can you help?
So sorry guys, I’ve been insanely busy. My responses to things here will be pretty slow, but I’ll do my best to respond at some point!
@Vincenzo: Correct
@Thomas Misund Haven’t actually looked at this…I would imagine adding a Simple Taxonomy with the same slug as the Custom Taxonomy would work, but that is more of less a guess based on how I think the other plugin works.
@Ray Sorry, no intention of working towards WPMU compatibility, but WPMU should be heading more towards WP compatibility in the future (or so I read a while ago), so this may fix itself at some point. Also, not sure what you mean by differentiating between tags…they should be displayed separately everywhere.
@ts I had a bit of trouble with modifying the rewrite rules to do what I wanted (that specifically). I filed a bug with WordPress but they haven’t fixed it yet.
@MK @Len I believe there is a way to define a page for the taxonomies (and what sidebars there are, etc)…did you try creating a file called *TAXONOMY_NAME*.php in your theme folder?
Hi Brian, thanks for getting back to us. I can try setting up the taxonomy file, but my question now is: what exactly would we have to define in the PHP?
Thanks Brian. Because Atahualpa theme does not have a page.php file, we have to use index.php. I’ve copied this to hotel.php, but to no avail. Can you look at the index.php code below (also hotel.php) to see what I might need to change so that the sidebars do not disappear ? BTW, really appreciate your huge efforts.
Len.
Style & edit the Center column */
bfa_center_content($bfa_ata['content_above_loop']); ?>
Style & edit the Center column */
bfa_center_content($bfa_ata['content_inside_loop']); ?>
Style & edit the Center column */
bfa_center_content($bfa_ata['content_below_loop']); ?>
Style & edit the Center column */
bfa_center_content($bfa_ata['content_not_found']); ?>
Hi, I’m trying to build in the output of tags into my theme. I’m not using the loop, so I’am searching for a way to get the tags for a post id.
Something like that (It’s just a not working example). Can you help me to finish my function please? It should output an array with the tags (for example “genre”) for a single post_id.
public function get_PostGenre($post_id ){
global $wpdb;
$sql = ”
SELECT term_taxonomy_id
FROM $wpdb->term_relationships
WHERE ( object_id = ‘$post_id’ )”;
$Results = $wpdb->get_results($sql);
foreach ($Results as $key => $Result) {
echo $Results[$key].”;
}
}
With this code I can list the Tags now, but it is listing the name of the category where the post is in, too.
How can I exclude the category names? I’m not very good at SQL
Please help.
/****************************************************************************************************************************************
* Gibt ein Array mit dem Genre zurück
*
* @return: Der Authordes Posts
****************************************************************************************************************************************/
public function get_PostGenre($post_id ){
global $wpdb;
$sql = ”
SELECT name
FROM $wpdb->terms
WHERE term_id IN (
SELECT term_taxonomy_id
FROM $wpdb->term_relationships
WHERE ( object_id = ‘$post_id’ )
)”;
$Results = $wpdb->get_results($sql);
foreach ($Results as $key => $Result) {
echo ”;
echo $All[$i]['tax'] = $Result->name;
}
}
I think it works now. I’m not sure if the code is optimal. Perhaps someone can give some advice how to optimize it.
public function get_PostGenre($post_id, $Category ){
global $wpdb;
$sql = ”
SELECT $wpdb->terms.name, $wpdb->term_taxonomy.description
FROM $wpdb->terms
LEFT JOIN $wpdb->term_taxonomy
ON $wpdb->terms.term_id = $wpdb->term_taxonomy.term_id
LEFT JOIN $wpdb->term_relationships
ON $wpdb->term_taxonomy.term_id = $wpdb->term_relationships.term_taxonomy_id
WHERE $wpdb->term_taxonomy.taxonomy = ‘$Category’
AND $wpdb->term_relationships.object_id = ‘$post_id’
“;
$Results = $wpdb->get_results($sql);
foreach ($Results as $key => $Result) {
$All[$i]['genre'] = $Result->name;
$All[$i]['beschreibung'] = $Result->description;
}
return $All;
}
Hello, is there a function to display all the posts within a certain taxonomy term?
1. Like you can display the last post within a category i would like to be able to display the last post which matches ‘taxonomy_term’='taxonomy_value’.
thanks
Brian, Thanks so much for the awesome plugin … I would like to report an issue:
When creating a hierarchical taxonomy (like categories) which will allow sub items, following can happen:
1) create term name “New York” with slug “new-york”
2) create term name “New York” with slug “new-york-city”
3) a warning is issued for using the same name, so change name to “New York City”
3) after entering the term “New York City”, edit term name “New York City” and change its name back to “New York”
4) the term disappears from the terms list page
It would be nice to key off of the “slug” and not the “name” so that you could have two identically names terms such as “New York, New York”
Brian, the disappearing term only seems to happen in the following scenario:
Taxonomy:
States
Terms:
All
- New York
– New York (disappears)
It does NOT happen in this scenario:
Taxonomy:
States
Terms:
New York
- New York
Additionally I seem to be having an issue with “Link Categories”, after installing the “Custom Taxonomies” plugin the “Link Categories” admin page produces the following error:
faultCode0faultStringCatchable fatal error:Object of class WP_Error could not be converted to string in C:\Apache2\docs\farinspace\trunk\fresnojazz\html\wp-admin\edit-link-categories.php on line 178
Why does it produce two widgets of every taxonomies I made? One widget shows the hierarchical version, another a non-hierarchical one, thus there are two widgets of the same taxonomy. Could you fix this?
Thanks for the plug-in, though! Just what I’m looking for. Great job!
on fresh new installation of 2.8.4 WordPress
hardaware & soft
FreeBSD 6.3-RELEASE-p2 i386
php 4.4.8
Zend Memory Manager enabled
eAccelerator 0.9.5.2
Memory Size 67,108,828 Bytes
Memory Available 3,272 Bytes
php.ini
memory_limit 10M
Fatal error:
Allowed memory size of 10485760 bytes exhausted (tried to allocate 46080 bytes) in /home/xxxxxx/www/wp-admin/includes/upgrade.php on line 1473