using custom taxonomies on non wp table?

I’m building a program registration system that will have a complex data structure. There are programs (custom post type, CPT), teachers (CPT), registrations (custom table and meta table), payments (custom table and meta table), and later accommodations (CPT) and lastly Users (wp users table).

I want to be able to use nice wordpress taxonomy features with my custom registration and payment tables. But I’m assuming I can’t because the taxonomy system is only for the posts table. Is this correct? Basically I want to easily assign categories to registrations, and later be able to search on that, and have it flexible so the user can create their own categories.

I ruled out using custom post type for the registrations and the payment tables only because then I would need a separate plugin to link everything up (scribu’s post to post plugin) and it would make any mysql queries incredibly complicated.

any advice would be greatly appreciated.

1 Answer
1

You can assign taxonomies to objects saved in tables other than the posts table. WordPress explicitly supports that (e.g. there is the function _update_generic_term_count to update the term count for those types of taxonomies) and even use it for links.

I have used it once.

Just register your taxonomies as you would for regular post types ( register_taxonomy( 'your_taxonomy', 'registration', $args ); ).

register_taxonomy_for_object_type( 'your_taxonomy', 'registration' ) won’t work though. I need to fill a bug report for that… (well, that’s what I said to myself last time and I forgot… 🙂 )

Leave a Comment