Custom Taxonomies

February 19th, 2010
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
  1. September 29th, 2009 at 03:08 | #1

    Hi, I love this plugin–does all the backend stuff I want it to do. I’ve tried Simple Taxonomies and it just doesn’t compare. Please don’t abandon this!

    Unfortunately, I’m getting a 404 error when I try to click on the links in the widget. (http://richendagould.com/writing Publications list) I’ve used this plugin on another site and don’t have this problem there, so perhaps it’s interacting with another installation?

    Also, I’m curious about how the taxonomies can be called in a theme, and each term made linkable within a post. Say, I want to display the custom taxonomy for Fruit above the post, and the custom taxonomy for Color below it.

    Example:
    Custom_fruit: Apples
    This is a post about trees
    Custom_color: green

    Thank you for your time and efforts thus far, and any help you can provide now.

  2. November 1st, 2009 at 03:39 | #2

    Hi! Just wondering… what does the “Allow nested terms” option do?

    Cheers!

  3. November 7th, 2009 at 03:05 | #3

    Here’s a bug that I found…

    Clicking on a term from a particular taxonomy in the Edit Post page will return “No posts found” if the term has the following criteria:
    - used only once
    - used in the most recent post (ie. positioned at the top of the list in the Edit Post page)

    Also the custom taxonomies doesn’t seem to show in the filter dropdown menu.

    Hopefully you can have a look at these issues.

    Thanks again for the plugin. It has a lot of useful features that I can’t get from Simple Taxonomies plugin.

  4. November 7th, 2009 at 03:13 | #4

    Also is it possible to have the custom taxonomies show in the ‘Quick Edit’ window?

  5. November 7th, 2009 at 14:47 | #5

    Found another bug here…

    After I selected a term for a post from a particular custom taxonomy and published it. Then when I edited the same post and decided I didn’t want any term for that post, I couldn’t seem to deselect all terms (ie. select none) and published it. The updated post always leave the most recent selected term(s) checked.

  6. Ian
    December 1st, 2009 at 13:35 | #6

    Hello All. I’ve added this plugin to my WP install (2.8.6) and have no trouble adding & managing my taxonomies…even the permalinks work well. However, rather than having the permalink return a post-styled list (as I’m using the taxonomies for pages, not posts) I’d like to add to my template a line that will return all given items under a tax name. According to the readme, I added if(function_exists(‘custax_list_terms’)) custax_list_terms(‘thing’); where thing=tax_name but nothing is pulled in even though several pages have checkmarks in the tax_name box. Please advise.

  7. December 22nd, 2009 at 06:28 | #7

    @Brian: Have you resolved problem involved by @Giraldi_Maggio ? I confirm existing problem, it’s impossible now, to deselect all terms from a post and publish it.
    Any suggestion ?
    Tnx in advance, great plugin !

  8. Jonathan
    February 4th, 2010 at 21:00 | #8

    Hi there — I’m noticing users cannot create their own terms within a given taxonomy like an admin can — how do I give a user permission to do this?

  9. Angelia
    February 9th, 2010 at 00:55 | #9

    Hi Brian — I’ve stalked and learned that you’re alive and well on twitter, and that you’ve been busy making FF extensions, but, if you’ve got a sec, it would be super groovy, perhaps even worth my first donation ever, for you to take a look at a couple of things over here with your Custom Taxonomies code. I’ve spent the last three days trying to work out a mashup of the three existing taxonomy plugins that would merge nicely with the upcoming WP3.0 features and now I find myself sitting here with my head spinning 360 and my eyes bulging out. This plugin would need to allow for custom styled meta boxes ( choice of dropdown, checkbox or default for non-hierarchical … hierarchical default will be in 3.0 – so must be able to migrate nicely from any plugin code providing that functionality early ) … needs to allow deselecting a checked term from a saved post — this is the bug that is making your existing code unusable at the moment —- needs to just be very aware in general of the core WP code changes coming up and be compatible with it in a way that everything continues to function as expected without its existence.

    Problem is, your code is really well written, has nice jQuery integration yadda yadda, and it just seems like such a huge waste of time to attempt to reinvent the wheel. It needs such minor work to make it a real godsend right now that every time I start in on something, I find myself just going back to your code and going why? WHY? Why can’t I just get this to work, it’s already written, and way better than I could do. AND it’s over my proverbial head to debug it. Okay, I guess what I’m saying is … please? Can you give it a look and let us know there is life here’bouts?

  10. February 9th, 2010 at 01:16 | #10

    Ok all, it looks like he most universal complaint is the inability to deselect an item from a post. I should be able to recreate and debug this fairly easily, so I’m going to try and tackle it this weekend. I don’t think I’ll be adding new features to this plugin for a while, but the plugin should at least work to its current spec.

    Thanks for all the kind words!

  11. Angelia
    February 9th, 2010 at 01:59 | #11

    Aha!! Good on ya! It was my stalking wasn’t it? Most excellent news!

  12. Ami
    February 9th, 2010 at 17:43 | #12

    GREAT plugin! So, agreed on the deselection, but I also have a question. I’m using this for a custom link taxonomy and can’t seem to figure out the code to select all links with a given taxonomy. Any direction would be fabulous – thank you so much!

  13. Angelia
    February 18th, 2010 at 21:36 | #13

    Hi Brian, just curious if you were able to fairly easily recreate the bug and squash it last weekend, or if other hurdles have come up. If possible, it would be great to get an update from you. I realize, of course, that your hard work is coming to us in the form of pure altruism, so please don’t mistake my inquiries as inquisitions okay? I personally want to use this on a client site, and naturally, it is one of the first things that needs to be implemented before I can continue building out the site. I’ve pushed the wait, no, wait some more envelope about as far as I can, so, naturally, I am eager to see this come to fruition, or will need to take another route entirely on the site build. Hence my impatience. Would so love to implement this properly, so, if you get a chance to give us an update it would be much much appreciated. Just give it to us straight okay? We can take it. Done soon? Stop holding our breath?

  14. February 19th, 2010 at 00:48 | #14

    @Angelia: Don’t worry, you’ve been incredibly polite, and I take nothing you’ve said he with as demanding.

    I’ll give it to you straight: all done, 1.2.5 is out, this weekend kept me fairly busy, so it took another few days (sorry if I made you nervous).

    I’m waiting for the wordpress plugin system to recognize it (should take 10 minutes or so) and package it up, then I’ll update the download link.

    Ask an ye shall receive!

  15. Angelia
    February 19th, 2010 at 00:56 | #15

    Hallelujah hallelujah lalalalalluuuuuuueaujah! You rock!! Hey, I have a few questions about how your code will integrate when 3.0 is released with it’s new hierarchical features/metaboxes/custom post types et al, and was wondering if, when you get a chance, I might conversate with you “minutely” of course ( won’t bug ) just to see if I will hit any hurdles in the transition. If this would be possible, please do feel free after a long siesta on the beach to shoot me a quick email – or could discuss here if better … or possible. Thanks again for all yer hard work on this Brian!!

  16. February 23rd, 2010 at 05:26 | #16

    You Rock Man. The plugin is simply “The Superb”. I have a small question. when we create a taxonomy, there seems to be two widgets coming on the edit post[admin]. one where you can add a taxo[tag], other where you can select and add a taxo,do we really need two widgets?
    thanks for the plugin..!

  17. emily
    February 28th, 2010 at 04:48 | #17

    just felt like dropping by to say hi… since i’m the emily in the yahoo intern podcast :D hope you’re doing well after the internship so long ago!

  18. March 8th, 2010 at 14:59 | #18

    Hi
    Firstly, great plugin, thanks (though I do wonder why the WP crew haven’t included much of this in core yet – I am using WP V2.9.2).

    One question/snag:

    A have a taxonomy names ‘lists’ set up, with the option ‘Add permalink URL (/%slug%/%term%)’ ticked.

    This works fine for calls to and from custax_list_terms(…) and wp_tag_cloud(…) etc – all of which render links to eg: http://mysite.com/?lists=mylist-a. Thereafter I catch the requests in the taxonomy-lists.php theme file which lists posts in the taxonomy term fine.

    However, the function custax_wp_dropdown_terms(…) generates a drop down list requesting terms by term_id, rather than by slug – ie.

    Please select a category…
    term A
    term B
    … etc

    (extra spaces are inserted intentionally here to render in this post).

    as a result, when the the drop down box form parameters are received by the taxonomy-lists.php (or similar file), it fails, since it is attempting to get posts in term by slug, rather than by id.

    whilst i can code my way around this/produce some alternative method that will work with both forms, am i missing a smarter way to deal with this apparent ambiguity in the url syntax for taxonomies? (ie. is there an alternative syntax eg. http::/mysite.com/?taxonomy=lists&term_id=123 that I/we should be aiming to implement here, rather than an arbitrary hack?

    thanks for any thoughts/ideas you have.

  19. March 8th, 2010 at 17:52 | #19

    ps. I’ve just spotted a solution – youve thoughfully included the argument slug_value=1 to the custax_wp_dropdown_terms() function. this creates a dropdown that sends the term slug rather than the term id and consequently my taxonomy theme files now work as expected.

    thanks :)

    hope this is helpful to someone.

  20. March 11th, 2010 at 17:13 | #20

    Sorry for probably missing something obvious, but what’s the key to getting the description to display for a term in the taxonomy? For a category it’s


    This is the text to describe category A

    What’s the equivalent for taxonomies created via this plugin?

  21. March 11th, 2010 at 17:14 | #21

    trying that code again:

    <?php if (is_category('Category A')) { ?>
    <p>This is the text to describe category A</p>

  22. March 16th, 2010 at 08:53 | #22

    OK, I found it here: http://bit.ly/9ldLdc :

    <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?>
    <?php echo term_description( '', get_query_var( 'taxonomy' ) ); ?>

  23. March 16th, 2010 at 22:30 | #23

    Glad you found a solution! Sorry for not chiming in, it’s been another busy week for me :) .

  24. Toddz
    March 17th, 2010 at 20:06 | #24

    What a great plugin! But i’m having a problem and i’d love to know if others have it too.

    I can create a custom taxonomy, say “Colors”, and on a post, I can assign it one ore more terms (red, blue). And on the List of Posts, i see the terms in a Colors column.. great.

    If the post has Status=PUBLISHED:
    + i can click the terms (red, blue), and get a filtered list of posts that have the term i clicked. (edit.php?colors=red).
    + the Colors page that lists the terms shows how many posts have each term.

    BUT if a post is NOT PUBLISHED (has status: Draft, Pending..):
    - clicking the terms in the List of Posts does NOT find the post.
    - the Colors page does NOT show that post for the terms it has
    (though when i edit the actual post, the terms ARE all still there).

    Has anyone else seen this? Or is my wp just wacky? I had used some custom Statuses (stati?) before.

    thanks in advance.

  25. March 18th, 2010 at 12:32 | #25

    When I try to go into one of my taxonomies and enter a description (and hit Update), I get a screen that just says, “Are you sure you want to do this?” with no buttons or links to confirm. Any ideas?

  26. Toddz
    March 18th, 2010 at 12:41 | #26

    UPDATE: i found that part of the issue above may be related to WP itself. On the wp-admin Categories page (Posts > Categories) and Post Tags page (Posts > Post Tags), the terms listed on the right show counts of how many posts use each term… but ONLY for PUBLISHED post, ignoring posts of any other Status! This is the same issue i mentioned above with the “Colors” page (for my colors Custom Taxonomy). So this seems like a WP core issue (for me at least).

    That said, on the Edit Posts page (Posts > Edit), WP categories and tags can be clicked to filter/find post that use those terms.. regardless of the STATUS of the post, so it includes Draft, Pending, etc. But the terms for my Custom Taxonomies (red, blue, etc) don’t work the same way.. they find ONLY PUBLISHED posts. The url shows edit.php?colors=blue and the page says “no posts found”.

    Any insight tremendously appreciated. Thanks!

  27. Toddz
    March 19th, 2010 at 01:59 | #27

    Possible BUG (at least for me):
    When I assign some terms from a Custom Taxonomy (via checkboxes) to a post, and later i make any changes to that post via Quick Edit, the custom taxonomy terms are lost.

  28. March 22nd, 2010 at 10:23 | #28

    (re my problem :) Using the good ‘ol ‘deactivate-all-plugins-and-reactivate-one-by-one’ I located the culprits as my Google Analytics and/or Google XML Sitemaps plugins (two that I expected to play nice with others!) Anyone know why, or how I could get them to co-exist with Custom Taxonomies?

  29. Adam
    March 23rd, 2010 at 11:46 | #29

    Great plugin but I have the following problem:
    I have some wp-categories and some custom-taxonomies that share the same name.
    These get mixed up.
    When I go to the category ‘digital design’ list I see items associated to the ‘digital design’ taxonomy too.
    I had similar abbreviations for both category and custom-taxonomy but I’ve changed them now and they still get mixed up.
    Any ideas?
    Cheers
    Adam

  30. Sam
    March 25th, 2010 at 09:34 | #30

    So does this support searching via multiple taxonomies now? So I can search via price and location etc at the same time? More than willing to donate if I can get that functionality working on my site.

  31. Ami
    March 31st, 2010 at 17:21 | #31

    So sorry for the duplicate comment, but I’m using this for a custom link taxonomy and can’t seem to figure out the php code to select all links with a given taxonomy.

    Any direction would be fabulous – thank you so much!

  32. brainsolid
    April 6th, 2010 at 07:49 | #32

    Hi! Can someone help me to do template The Buffet Framework theme? When i click on taxonomy, it don’t show archive for it, just 404 error

  33. Pablo
    April 27th, 2010 at 06:33 | #33

    Hi Everybody!

    Does any one know how to look for two different taxonomies in the same query. For example: url/?lan=es&type=tale. The query results show me both, posts with lan=es OR type=tale but I want AND logic, only show posts with lan=es AND type=tale. Any solution?? Thanks!

  34. pmdci
    May 3rd, 2010 at 17:15 | #34

    I just translated the plug-in into Brazilian Portuguese, but I have no idea where to put those files and how to rename them! Can someone please advise?

    Regards,
    P

  35. pmdci
    May 4th, 2010 at 00:25 | #35

    @pmdci

    Can soemeone please help me with my attempts to localise this plug-in?

    1) First thing I done is to add the following at the custom-taxonomies.php file. This is the first function I call:

    // Enable internationalisation
    $plugin_dir = basename(dirname(__FILE__));
    load_plugin_textdomain( ‘custom-taxonomies’, ‘wp-content/plugins/’ . $plugin_dir, $plugin_dir );

    2) Then I uploaded my translated file custom-taxonomies-pt_BR.mo and custom-taxonomies-pt_BR.po (even though I am quite sure this one is not necessary) to the plug-in’s directory.

    However, for some reason this plug-in just doesn’t want to be localised!!! Can someone please advise?

    Thanks,
    P.

  36. pmdci
    May 4th, 2010 at 01:04 | #36

    @pmdci

    I found the solution, this is what needs to be added to the very first function in custom-taxonomies.php:

    // Enable internationalisation
    $plugin_dir = basename(dirname(__FILE__));
    load_plugin_textdomain( ‘custom_taxonomies’, ‘wp-content/plugins/’ . $plugin_dir, $plugin_dir );

    You can see that the textdomain for this plug-in is custom_taxonomies and NOT custom-taxonomies (which is how the plug-in is called, its directory and its main php file). By replacing custom-taxonomies with custom_taxonomies in the above function, everything works fine.

    you MUST add this function in the custom-taxonomy.php file as the very function at the top, just after the license comments. The author of this plug-in haven’t added this. Without this function, it would never load the localisations.

  37. June 18th, 2010 at 07:58 | #37

    Hi
    Been using Custom Taxonomies for a while – thanks. It caused my whole site to crash when I upgraded to WP 3 – just got it working again when I removed the plugin. Just to let you know.

    The taxonomies themselves seem to have survived but now I can’t add them to new posts. I have yet to investigate how the default WP taxonomies under WP3 work …

  38. June 18th, 2010 at 09:46 | #38

    Yes. Plugin is not working with WP3.0. It hasn’t work with betas and rc, but I thought that it will be fixed.

    I get error:

    Fatal error: Call to a member function add_rewrite_tag() on a non-object in (…)/wp-includes/taxonomy.php on line 275

  39. Hakan
    June 18th, 2010 at 14:18 | #39

    hi,

    i’ve been using the plugin for ~1 year. I built up the site with this plugin and now i’m getting the “fatal error” because i upgraded to wp 3.0.

    Is there a way to transfer custom-taxonomies database to wp3.0 default taxonomy system?

    Also a little patch to the plugin to solve the problem would be great.
    Thanks.

  40. June 18th, 2010 at 14:56 | #40

    Hi.

    I also had problems when I upgraded to WordPress 3.0

    I solved it combining 2 patches, although one includes editing a WP core file (which is never recommended, but I needed to solve this).

    First, make the changes as stated in: http://core.trac.wordpress.org/ticket/13957

    Second, edit the file “custom-taxonomies.php” and comment the line 31. So the line “require_once($custax_dir . ‘/backwards_compatibility.php’);” becomes “// require_once($custax_dir . ‘/backwards_compatibility.php’);”

    That should make everything work but this is a temporal fix and I don’t know if Brian is going to update this plugin. I hope he does! :)

    Hope that helps.

  41. June 18th, 2010 at 15:08 | #41

    @Camilo
    Never mind that! I can’t add new terms to the taxonomy… my bad! :(

  42. Hakan
    June 18th, 2010 at 16:28 | #42

    bah,

    downgraded to 2.8 and now permalinks of custom-taxonomies are giving 404. :/

  43. Hakan
    June 18th, 2010 at 16:45 | #43

    Ok i got things to work again.

    ** via FTP, go to wp-content/plugins. create a new folder. move /custom-taxonomies folder to the new folder you just created.
    **open admin panel, export database
    **downgrade wp from 3.0 to 2.8.
    (download 2.8 files from wordpress.org. upload everything except wp-content and wp-config. after upload, go to /wp-admin and click “update database”. thats it!)
    **move your /custom-taxonomies folder to wp-content/plugin via FTP.
    **if your content is gone import your database xml file via admin panel, if not skip this step.
    **activate custom taxonomies plugin from admin panel.
    **from left menu, under settings, go to “Taxonomies”. click edit under one of your taxonomies, dont touch anything there, just click update. do this to all your taxonomies to repair taxonomy permalink structure.

    Done :)

  44. June 20th, 2010 at 11:56 | #44

    I’ve patched some of the code to get it working for WP3.0.

    http://pastebin.com/5Ssgr2hf (custom-taxonomies.php)
    http://pastebin.com/gE9z2R15 (custax.class.php)

    It’s definitely not perfect yet, and I’m still testing it out on my local install. Comments are welcomed.

  45. June 23rd, 2010 at 09:15 | #45

    I found a workaround – new plugin: GD Custom Posts And Taxonomies Tools.

    How to use it:

    1. Disable CT plugin (write down slug-names of yours CT).
    2. Upgrade to 3.0
    4. Install GD Custom Posts And Taxonomies Tools (your taxonomies will not appear yet)
    5. Create new taxonomies with slug-names that you used before (use hierarchical option when necessary) – old data will appear
    6. Add new list/cloud widgets and configure it

    Thats all.

  46. June 23rd, 2010 at 12:37 | #46

    @borg
    Wow! That worked just great!
    Thanks for sharing =)

  47. June 24th, 2010 at 23:51 | #47

    Hey borg! You saved my life! thank you so much! I thanked you also in the WP forum support! http://wordpress.org/support/topic/411730/

    Now my website went to normal again! If you like electronic music, check it out working beautifuly: http://www.freshDJSets.com

    Thanks! Thanks! Thanks! Thanks! Thanks! Thanks! many thanks!

  48. June 24th, 2010 at 23:52 | #48

    Hey borg! You saved my life! thank you so much! I thanked you also in the WP forum support! http://wordpress.org/support/topic/411730/

    Now my website went to normal again! If you like electronic music, check it out working beautifuly: http://www.freshDJSets.com

    Thanks! Thanks! Thanks! Thanks! Thanks! Thanks! many thanks!!

  49. June 25th, 2010 at 02:46 | #49

    Hey guys,

    So sorry for not having time to work on this plugin: startups are a bitch.

    If someone (ping?) can get me a working patch file I’d be glad to patch the code, I just don’t have the time to test a fix myself. I’m sorry if this causes problems, I wish I had more time to improve the code (though I’m glad to see WP adding this into the core functionality).

    As nacin said at http://wordpress.org/support/topic/411730 – your data is safe, it’s stored just as WP would if this were native functionality, the only issue is in telling WP that the taxonomy exists, since the mechanism to do so has apparently changed.

  50. June 26th, 2010 at 09:39 | #50

    Here’s my local patch http://pastebin.com/NkEssnJH

    But as suggested by other folks, I switched over to the GD taxonomy plugin, so this patch didn’t get as much testing as I would have like.

Comment pages
  1. December 29th, 2008 at 18:22 | #1
  2. January 21st, 2009 at 17:46 | #2
  3. January 30th, 2009 at 18:28 | #3
  4. February 15th, 2009 at 17:28 | #4
  5. February 19th, 2009 at 05:38 | #5
  6. March 2nd, 2009 at 00:47 | #6
  7. May 26th, 2009 at 20:26 | #7
  8. November 18th, 2009 at 05:53 | #8
  9. April 27th, 2010 at 00:13 | #9
  10. June 3rd, 2010 at 02:52 | #10
  11. July 20th, 2010 at 17:26 | #11