I have created a custom post type and a custom taxonomy. The issue is that I can not make the custom posts hierarchical with the categories it is in. I have the following code,
function AppManager_custom_post() {
$labels = array(
'name' => _x( 'APKS', 'post type general name' ),
'singular_name' => _x( 'APK', 'post type singular name' ),
'add_new' => _x( 'Add New APK', 'APK' ),
'add_new_item' => __( 'Add New APK' ),
'edit_item' => __( 'Edit APK' ),
'new_item' => __( 'New APK' ),
'all_items' => __( 'All APKs' ),
'view_item' => __( 'View APK' ),
'search_items' => __( 'Search APKs' ),
'not_found' => __( 'No APK found' ),
'not_found_in_trash' => __( 'No APKs found in the Trash' ),
);
$args = array(
'labels' => $labels,
'description' => 'Holds Apps and meta data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'thumbnail', 'excerpt' ),
'has_archive' => true,
'hierarchical' => true,
'rewrite' => array('slug' => 'APKs')
);
register_post_type( 'apps_post', $args );
flush_rewrite_rules();
}
add_action( 'init', 'AppManager_custom_post' );
And I have the following to create the taxonomy,
function AppManager_custom_taxonomy() {
$labels = array(
'name' => _x( 'App Categories', 'taxonomy general name' ),
'singular_name' => _x( 'App Category', 'taxonomy singular name' ),
'search_items' => __( 'Search App Categories' ),
'all_items' => __( 'All App Categories' ),
'parent_item' => __( 'Parent App Category' ),
'parent_item_colon' => __( 'Parent App Category:' ),
'edit_item' => __( 'Edit App Category' ),
'update_item' => __( 'Update App Category' ),
'add_new_item' => __( 'Add New App Category' ),
'new_item_name' => __( 'New App Category' ),
'menu_name' => __( 'App Categories' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'rewrite' => array( 'hierarchical' => true, 'slug' => 'Apps' )
);
register_taxonomy( 'appCategory', 'apps_post', $args );
}
add_action( 'init', 'AppManager_custom_taxonomy', 0 );
No matter how I try the hierarchical function it never maps to the category that I add it to. Is it possible?