CPT-onomies: Using Custom Post Types as Taxonomies
[resolved] Custom Type Category Keep Structure (4 posts)

  1. ashshake
    Posted 2 years ago #

    Hello I am using CPT-Onomies to create product categories with more fields and a nicer management offering than using a normal wordpress taxonomy. All is going well, though when you choose categories and save the post the selected category checkboxes are pulled out of the hierarchical structure and are moved to the top of the list.

    As the product categories list has multiple sub categories with the same name it makes it quite confusing as to which ones are actually selected. I have found a link that explains how to remove the standard wordpress category meta box and replace it with a version that forces the structure to remain in place:


    I have tried to use it and replace the:

    if ( $metabox['callback'] == 'post_categories_meta_box' ){

    with the name of the meta box generated by your plugin but no dice :(

    Would you perchance have any suggestions as to a way of implementing this in code. It may be useful for other people too and possibly something that can somehow be added as an option in the plugin settings per cpt-onomy.

    Thanks very much for your time


  2. Rachel Carden
    Plugin Author

    Posted 2 years ago #

    Well, it uses the wp_terms_checklist() function so an easy way to fix this would be to use the 'wp_terms_checklist_args' filter:

    add_filter( 'wp_terms_checklist_args', 'my_website_wp_terms_checklist_args', 1, 2 );
    function my_website_wp_terms_checklist_args( $args, $post_id ) {
       // obviously replace this with your taxonomy or remove it altogether
       if ( 'actors' == $args[ 'taxonomy' ] ) {
          $args[ 'checked_ontop' ] = false;
       return $args;
  3. ashshake
    Posted 2 years ago #

    Thanks Rachel this works beautifully!

    I'm still new to WP, though learning bit by bit. I probably should have figured this out by myself but alas my deadlines are always too tight.

    Great plugin by the way, I neglected to mention it before.

  4. Rachel Carden
    Plugin Author

    Posted 2 years ago #

    Yay! And thank you. :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic