CPT-onomies is a WordPress plugin that allows you to create, and use, taxonomies powered by your custom post types, using the post titles as the taxonomy terms.

CPT-onomies work just like any other taxonomy, allowing you to use WordPress taxonomy functions, like get_terms() and wp_get_object_terms(), to access the information you need. Unfortunately, not every taxonomy function works right now but don’t worry, I’ve created CPT-onomy functions to help bridge the gap between WordPress and the plugin. The CPT-onomy functions even mirror the WordPress functions, using the same parameters and return values.

Use the following documentation to see which WordPress taxonomy functions work (and how to use them) and when you’ll need to use a CPT-onomy function. The documentation also includes function parameters, return values, examples, and other helpful information.

 
  • http://twitter.com/WiiLikeU Wii Like U

    Thanks for this plugin, it’s really useful and I need it! My headpain gone)

    • rachelcarden

       You’re welcome! Glad it’s so helpful!

  • Paul

    In your example, Directors are listed with checkboxes to the left, while Actors just have a search box. I added 2 CPT-onomies to my setup, and both are search boxes. How would I change it so that both will become lists with checkboxes?

  • JuniperPaul

    From your work with post types and taxonomies, can you see a way to use the same post type as two different taxonomies?

    Let’s say you’re building a shopping site. As a customer you can select products to add to your Favorites and you can also select products for your shopping cart. One way to engineer this would be to store selections as taxonomic connections between Customer and Products. But both Favorites and Cart make connections to the same Products post type. Your plugin doesn’t appear to allow this, since Products would be listed just once as a post type one can use as a taxonomy for the Customer post type. Can you see any way to wrangle it? Does your plugin create a taxonomic alias for a post type, and if so could one create two aliases for the same post type?

    • rachelcarden

      Hmm. That’s an interesting thought. Right now my plugin does not do this but I might add that to my list and do some research. Your best solution at the moment might be to use CPT-onomies to create one of the relationships and use another relationship method for the other.

  • Chris

    Hi I might be missing something here but I have made a new custom post type and added a post but it just goes to a 404 error page? Do I have to enable something to use my current category and post template style

    • rachelcarden

      You will probably need to flush your rewrite rules. Go to Settings->Permalinks and click “Save Changes”.

      • Chris

        Hey Rachel, love the rapid response! Yes I have been changing a few settings. Initially had flushed the rewrite rules. Is there a way we can talk over email or private? I want to send a few URLs but dont want them to be public

        • rachelcarden

          Use my contact form

  • http://www.facebook.com/sam.sirrieh Sam Sirrieh

    Hi, I have a question. I have 2 post types and they are linked to each other. One is films and the second is actor. lets say for the movie I have xyz and for the actor I have Tom. When I am viewing Tom’s page, I want to add to his page “Known For” and the above film name. I was able to get that name but I need to display it’s Poster which I have a custom field for it a the film page. Is that possible? Or maybe use the featured image for that film? Thank you
    Sam

    • http://www.facebook.com/sam.sirrieh Sam Sirrieh

      Never mind.. Sorry did not see get objects term. I need a new pair of glasses :)

      • rachelcarden

        Glad you figured it out :)

        • http://www.facebook.com/sam.sirrieh Sam Sirrieh

          Hi Rachel, First, great script.. Love it. Thank you. I do have another weird issue going on. as I described above, when I go to the actor page, I can see the related films associated with, but when I go to the film page, it seems all actors are listed no matter what film page I go to. Here’s the code That I am using:

          Any suggestion will be greatly appreciated. Thank you

          • http://www.facebook.com/sam.sirrieh Sam Sirrieh

            It seems that when it’s empty, it echos all terms under all! any idea? Thanks

  • SN0WKRASH

    Hi, I only needed to create a custom post type for now. I did that, and the post is showing up, but it does not display like my other posts. Do I need to create a new template file that’s a copy of another, existing file, then rename it or something?

  • Bel

    I installed the plugin, created a custom post-type named “person” and attached it to posts.

    Then, I added the plugin widget and set the link to go to “Term Archive Page”.

    When I click on one of the links in the widget, let’s say “person1″, it goes to a page named “www.example.com/person/tax/person1″ which is a broken page with the error
    “Not Found The requested URL /person/tax/person1 was not found on this server.”

    I tried entering this url manually:
    http://www.example.com/?post_type=post&person=person1
    hoping it will list all posts categories as “person1″, but it actually gets the post of “person1″.

    I tried Settings->Permlink->Save but nothing changed.

    Any suggestions what could be the problem ?

    • rachelcarden

      Unfortunately, these archive pages are a pain in the butt because the cause could be a number of things. How do your settings look? Is the “Has Archive Page” for the CPT-onomy set to true?

      • Bel

        yes, it is set to true.

        • Bel

          the first one is true and the advanced one is blank

      • Bel

        I know programming very well, I just need little ques to know where to look for the problem.

        Is it a problem with your plugin or a problem in the configurations or wordpress ?

        Why the URL has this “/tax/” ? is it from your plugin or is it wordpress standard ? probably, it is your thing.

        If I want to check in your code, where is a good candidate to look for the problem ?

        • rachelcarden

          Well the manual parameter URL probably didnt work because
          ‘cpt_onomy_archive=1′ is required for CPT-onomy archive pages so it
          would be ‘http://www.example.com/?post_type=post&person=person1&
          cpt_onomy_archive=1′.

          The “/tax/” is my thing, but its something you can change in the settings under “Archive Page Slug”.

          I would check your rewrites. This could help you out: http://wordpress.org/plugins/rewrite-rules-inspector/

          • Bel

            the manual parameter URL does not work with or without cpt_onomy_archive=1

            in both cases, it shows the post of “person1″, not the list of posts categories as “person1″.

            Is this the expected behavior ? I am assuming not.

      • Bel

        Solved. The problem was in the rewriting rules. mod_rewrite was not installed, .htaccess did not exist and permalink was not enabled.

        Because of all of that, your plugin’s rewriting rules were not generated. Apparently, you rely on the rewriting rule to fix the manual URL. I mean, if I type the URL myself without relying on the rewriting rules, it does not work, because your plugin gets the post_type from the activated rewriting rule. To be more precise, I am talking about the file: manager.php function: revert_query_vars.

        I have a suggestion for a better way to fix the post_type. You can get the correct post_type (not the one that wordpress generated) from _GET. All what you need it a slight change in the function: “change_query_vars”. Near the end of this function, there are two copies of this line “unset( $query[ 'name' ] );”. Just add the following lines in the block of the first copy:

        if( isset( $_GET['post_type'] ) )

        $query[ 'post_type' ] = $_GET['post_type'];

        else

        $query[ 'post_type' ] = ‘post’;

        I tried it and it worked, although, I removed it because I do not know all the details of your plugin or wordpress, so may be I am messing something else.

        If you think this change does not mess with anything else, let me know, because I wanna go back and disable permalink and the rewriting rules.

        I hope you find this comment useful.

        Bye

  • Pingback: CPT-onomies: Using Custom Post Types as Taxonomies | Best WordPress Plugins & Themes

  • https://med.uth.edu/ Subigya Shakya

    @cf04cca68135ce6bce0e0c1224250baf:disqus This is a core plugin that I use in my environment for creating relationships. Thank you for creating such an awesome plugin.

    • rachelcarden

      You’re most welcome. :)

  • Mike Lewis

    In case anyone hasn’t pointed this out: I wasn’t sure what the /tax/ was for in the archive page slug, and so I removed it, and used: $post_type/$term_slug.

    Then, when I create a new custom post, I get a 404 error. This is because the /post-type/post-name/ is intercepted with your cpt_onomy_archive=1 query var.

    It might be worth explaining that this isn’t possible. Also, I love your documentation (your tabbed, color coded layout is awesome), and I found more than enough detail on specific functions. I couldn’t seem to find more of a conceptual understanding, and general example. I understand what the plugin is doing, but its more the rewrites, urls, slugs, archive pages, and those details that were a little confusing.

    Part of my confusion is in your name: “CPT-onomy” combines the idea of a custom post type, and taxonomy, which is great. However, when you refer to a CPT-onomy, are you referring to the Taxonomy, or the Custom Post Type? Your plugin creates both simultaneously, which is also great… However, I might suggest that you separate the two ideas.

    I think someone else suggested the ability to add two CPT-onomies to a CPT. Here’s a potential workflow:

    Keep the CPT creation separate from the CPT-onomy. Then, all CPTs (new and existing) appear in the list of CPT’s (the box you call “Other Custom Post Types”), and you can now add one, or more, CPT-onomies to that post type. Now you have separation of CPT and CPT-onomy.

    Showing the permalink structure under each item (CPT and CPT-onomy) could help users visualize and understand what’s going on:

    /product/shoe/ vs /product/tax/shoe/

    Cheers

    • rachelcarden

      Thanks, Mike. Consider your notes noted. :)

  • ViduaRarikola

    Great plugin ! Thanks a lot !
    This could be a very dumb question but gotta ask anyway. How do I remove “tax” from generated URL’s? is it possible?

    • rachelcarden

      Check out your “Register this Custom Post Type as a CPT-onomy” settings. There’s a field named “Archive Page Slug” that should help you out. :)

  • ViduaRarikola

    Now I really need your help. Everything works great except the pagination . When I go to next page of custom post type term, page is not found. Please help. Thanks so much in advance.