Hi everybody and thanks in advance for helping.
I am experiencing a problem with the categories I have created for my custom post type: when I click on the URL of the category (every category) I get the query error message. It is not a 404 page, it just seems that Wordpress cannot retrieve posts from the taxonomy.
This is code I have used into my functions.php to enable post type and taxonomy:
function themes_taxonomy() {
register_taxonomy(
'video_categories',
'video',
array(
'hierarchical' => true,
'label' => 'Categories',
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array(
'slug' => 'category-video',
'with_front' => true
)
)
);
}
add_action( 'init', 'themes_taxonomy');
function custom_post_type() {
$labels = array(
'name' => _x( 'Video', 'Post Type General Name', 'text_domain' ),
);
$rewrite = array(
'slug' => 'video',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'video', 'text_domain' ),
'description' => __( 'Videos', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'post-formats', 'custom-fields' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => false,
'has_archive' => true,
'exclude_from_search' => true,
'publicly_queryable' => true,
'rewrite' => $rewrite,
'capability_type' => 'post',
'taxonomies' => array('video_categories'),
);
register_post_type( 'video', $args );
}
add_action( 'init', 'custom_post_type', 0 );
I have already tried flushing cache for urls by updating permalinks but nothing. The archive page works fine for Post Categories therefore it can't be an error on that.
Any ideas?
Thanks!