WordPress.org

Support

Support » How-To and Troubleshooting » Subcategories listed incorrectly on Admin page for custom post type

Subcategories listed incorrectly on Admin page for custom post type

  • I’ve got a custom post type set up – “Webinar” – and a whole bunch of categories with subcategories. Now, in the master category list all the categories are listed correctly with their subcategories indented under them. But on the add/edit a Webinar page, the list of category checkboxes isn’t quite right: for one particular category, the subcategories aren’t listed below it. They’re all right at the bottom of the list, and not indented, like they’re parent categories. This is only for one category – the others are all listed correctly. And even weirder, when you do tick one of the errant subcategories and update the post, it gets moved to its correct place under the parent category.

    I don’t know what the cause might be. Incorrect parent ID’s in the database was my first thought, but then it’s displaying correctly in the master list. I don’t know enough about WP’s database structure to confirm.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I am facing the same problem, but with a more simple setup:

    No custom post type set, just a normal post
    Any category / subcategory seems to act this way

    When creating a new post the categories are listed are they are supposed to: subcategories are nested below their parents. Selecting either the parent or the subcategory alone and publishing or saving a draft of the post like that causes the categories to be listed at the bottom of the category list without being nested like they are supposed to. It gets fixed when either the parent category or the subcategory is added and the post updated.

    Using WordPress 3.3.1 (in Finnish).

    I’m having the same problem. This is a pretty big issue, because our writers can’t tell which category the errant subcategories belong to. If the subcategory is chosen, but not the parent, get_the_category doesn’t return the parent, and category-specific code on the page doesn’t run.

    I’m having exactly the same issue (3.3.1).

    On my Category page the categories are all indented correctly. On the actual edit page the Category box isn’t indented at all, until you click the parent and child and hit save. It’s very confusing.

    Here’s my code in functions.php Does anything look strange here?

    // Add Publication Categories
    add_action( 'init', 'create_publication_taxonomies');
    
    function create_publication_taxonomies() {
    	register_taxonomy('publication-type', 'publications', array(
    		'labels' => array(
    			'name' => _x( 'Publication Types', 'taxonomy general name' ),
    			'singular_name' => _x( 'Publication Types', 'taxonomy singular name' ),
    			'search_items' =>  __( 'Search Publication Types' ),
    			'all_items' => __( 'All Publication Types' ),
    			'edit_item' => __( 'Edit Publication Types' ),
    			'update_item' => __( 'Update Publication Types' ),
    			'add_new_item' => __( 'Add New Publication Type' ),
    			'new_item_name' => __( 'New Publication Type' ),
    			'menu_name' => __( 'Publication Types' )
    		),
    		'public' => true,
    		'hierarchical' => true,
    		'show_in_nav_menus' => false,
    		'query_var' => true,
      ));
    }

    Actually I may have a fix. I changed the register_taxonomy name to ‘publication_type’, changed the dash to an underline. Seems to have fixed this.

    register_taxonomy('publication_type', 'publications', array(

    Ha, actually it’s still broken but acting completely differently, with them indented by heirarchy when not selected and appearing unindented when selected.

    No idea why. Any thoughts?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Subcategories listed incorrectly on Admin page for custom post type’ is closed to new replies.
Skip to toolbar