0

I have some registered taxonomies like this one:

/********************************* Género *****************************/

function genre_init() {
    $labels_genre = array(
    'name' => _x( 'Géneros', 'taxonomy general name' ),
    'singular_name' => _x( 'Género', 'taxonomy singular name' ),
    'search_items' =>  __( 'Buscar Género' ),
    'popular_items' => __( 'Géneros Populares' ),
    'all_items' => __( 'Todos los Géneros' ),
    'edit_item' => __( 'Editar Género' ),
    'update_item' => __( 'Update Género' ),
    'add_new_item' => __( 'Añadir nuevo Género' ),
    'new_item_name' => __( 'Nuevo nombre de Género' ),
    'separate_items_with_commas' => __( 'Separa Géneros con comas' ),
    'add_or_remove_items' => __( 'Añade o quita Géneros' ),
    'choose_from_most_used' => __( 'Elige entre los Géneros más utilizados' )
    );

    // create a new taxonomy
    register_taxonomy(
    'Géneros',
        'reviews',
        array(
            'rewrite' => array( 'slug' => 'genre' ),
            'labels' => $labels_genre
        )
    );
}
add_action( 'init', 'genre_init' );

/**********************************************************************/

When using a plugin to show the links of each taxonomy value (e.g. "rock", "folk", ...) I saw the accent in the slug (http://dcodedmagazine/?taxonomy=Géneros&term=rock), so I tried to change the taxonomy name:

/**********************************************************************/

/********************************* Género *****************************/

function genre_init() {
    $labels_genre = array(
    'name' => _x( 'Generos', 'taxonomy general name' ),
    'singular_name' => _x( 'Genero', 'taxonomy singular name' ),
    'search_items' =>  __( 'Buscar Género' ),
    'popular_items' => __( 'Géneros Populares' ),
    'all_items' => __( 'Todos los Géneros' ),
    'edit_item' => __( 'Editar Género' ),
    'update_item' => __( 'Update Género' ),
    'add_new_item' => __( 'Añadir nuevo Género' ),
    'new_item_name' => __( 'Nuevo nombre de Género' ),
    'separate_items_with_commas' => __( 'Separa Géneros con comas' ),
    'add_or_remove_items' => __( 'Añade o quita Géneros' ),
    'choose_from_most_used' => __( 'Elige entre los Géneros más utilizados' )
    );

    // create a new taxonomy
    register_taxonomy(
    'Generos',
        'reviews',
        array(
            'rewrite' => array( 'slug' => 'genre' ),
            'labels' => $labels_genre
        )
    );
}
add_action( 'init', 'genre_init' );

/**********************************************************************/

and now the in the plugin widget I have to choose "Genero" instead of "Géneros", but I'm still getting the same slug. I don't really understand why I'm not able to change the slug of a custom taxonomy created by me. Any idea of what I'm missing?

Edit:

Indeed, the other taxonomy slugs are: artistas=alice-in-chains and not: taxonomy=artistas&term=alice-in-chains.

2º Edit:

Debug mode was disabled. Enabling it I can see the next Notice for each "Géneros" field printed: Notice: Trying to get property of non-object in /home/user/MyServer/project/wp-includes/taxonomy.php on line 3185

0

1 Answer 1

0

It was a really silly issue. The same slug was used by a tag, so here was the problem. When I deleted the tag the problem disappeared.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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