Support » Plugin: CPT-onomies: Using Custom Post Types as Taxonomies » Custom Type Category Keep Structure

  • Resolved ashshake


    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rachel Cherry


    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;

    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.

    Plugin Author Rachel Cherry


    Yay! And thank you. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Type Category Keep Structure’ is closed to new replies.