5

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.)

1 Answer 1

3

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.

0

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.