0

I've created a custom post type and a custom taxonomy. I can create new posts and assign those taxonomies, but it returns a 404 when I go to mydomain.com/mycustomtaxonomy/termslug.

Here is my code:

$labels = array(
    'name' => _x('Videos', 'post type general name'),
    'singular_name' => _x('Video', 'post type singular name'),
    'add_new' => _x('Nuevo', 'portfolio item'),
    'add_new_item' => __('Nuevo video'),
    'edit_item' => __('Editar video'),
    'new_item' => __('Nuevo video'),
    'view_item' => __('Ver videos'),
    'search_items' => __('Buscar videos'),
    'not_found' =>  __('Nothing found'),
    'not_found_in_trash' => __('Nothing found in Trash'),
    'parent_item_colon' => ''
);

$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'rewrite' => array("slug" => "video"),
    'hierarchical' => true,
    'menu_position' => 5,
    'supports' => array('title', 'editor', 'thumbnail', 'page-attributes')
); 

register_post_type( 'videos' , $args );
flush_rewrite_rules();

// Register custom taxonomy

register_taxonomy("familia_videos", array("videos"), array("hierarchical" => true, "label" => "Categorias de Videos", "singular_label" => "Categoria de videos", 'rewrite' => true  ));

And my permalink structure:

/%postname%/

I've created: taxonomy-familia_videos.php

I've refreshed the permalinks structure, but I always get a 404.

Any help?

Thanks

2

but it returns a 404 when I go to mydomain.com/mycustomtaxonomy

The problem is that you're expecting behavior that simply doesn't exist. Just like mysite.com/category will 404, so will mysite.com/mycustomtaxonomy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.