Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Is it a good practise to register custom taxonomy with a unique name (the $taxonomy parameter), and then use the rewrite argument to set a custom slug?

For example, I could create a taxonomy called list in two different ways. Like this:

add_action( 'init', 'custom_taxonomy_lists' );
function custom_taxonomy_lists() {

    register_taxonomy(
        'lists',

        // [...]
    );

}

OR, like this:

add_action( 'init', 'custom_taxonomy_lists' );
function custom_taxonomy_lists() {

    register_taxonomy(
        'john28_lists',

        // [...]

        array(
            'rewrite' => array( 'slug' => 'lists' ),

            // [...]
        )
    );

}

What I am asking is, is the latter (the 2nd code block) considered a good practise?

(This is the recommended way for registering custom post types, so I thought maybe it applies to custom taxonomies as well.)

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I don't see any downside to a more unique taxonomy name, or having the taxonomy name and slug be different. The downside to a dictionary word taxonomy name is a potential conflict if some other code registers a taxonomy with the same name.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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