I'm working on portfolio site, where I need to create a "portfolio" post type and divide posts in it by categories with urls like "/portfolio/category/", so the "category" is the category term.

/portfolio/ - custom post type "portfolio"

/portfolio/category/ - custom taxonomy "portfolio_category", related to "portfolio" type.

/portfolio/post/ - post of the "portfolio" custom post type.

What is the best way to make this url structure?

1 Answer 1


I hope i understand you :)

I think the easiet way (in my humble opion) the best way is to use taxomonies like so:

function portfolio_taxomony() {
register_taxonomy( 'portfolio', 'post', array( 'hierarchical' => true, 'label' => 'Web Design', 'query_var' => true, 'rewrite' => true ) );  

add_action( 'init', 'portfolio_taxomony', 0 );  

(Web Design if of course an example)

That way you'll have a url like this: http://www.site.com/portfolio/web-design/postname/

To me that looks great from an seo point of view because the url is like a "story" and also, easy to do..

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.