I can’t access the pages for my custom taxonomy

I’m working on a recipe site that has a custom post type, recipes, with two custom taxonomies for handling recipe categories and tags. The custom post type works and so does the custom taxonomy for the categories, i.e. i can access individual posts and category pages. However, when I try to access a custom taxonomy tag page, I get the wordpress 404 page.

I don’t really know how to troubleshoot this since wordpress isn’t giving me any useful error codes. Any suggestions?

2 Answers
2

I’ve run into this issues too, two time, two differents errors, first time I just go to permalink structure in the wordpress options and hit save, that was a problem witht my htaccess files, and the second time it was the way I register the slug,

Here is a complete working exemple :

/* Post type : offre_emploi */
register_post_type(
    "offre_emploi", /*Take this in note you'll need it*/
    ...

/* Register Taxonomy */
$labelsEmploisCat = array(
    'name' => _x( 'Catégories', 'post type general name' ),
    'singular_name' => _x( 'Catégorie', 'post type singular name' ),
    'add_new' => _x( 'Ajouter une catégorie', 'client' ),
    'add_new_item' => __( 'Ajouter une catégorie' ),
    'edit_item' => __( 'Modifier une catégorie' ),
    'new_item' => __( 'Modifier une catégorie' ),
    'view_item' => __( 'Voir une catégorie' ),
    'search_items' => __( 'Rechercher une catégorie' ),
    'not_found' =>  __( 'Aucune catégorie' ),
    'not_found_in_trash' => __( 'Aucune catégorie' ),
    'parent_item_colon' => ''
);

register_taxonomy(
    "proprietaires_pieces",
    array("offre_emploi"), //here goes the post type 
    array(
        "hierarchical" => true,
        "labels" => $labelsEmploisCat,
        "rewrite" => true
    )
);

Hope it’s help you

Leave a Comment