I’m creating custom theme for my personal website using WordPress 3.5.1. I have problem with the WordPress custom post type and taxonomy, here’s the detail:
- custom post type name:
articles
- taxonomy name:
article-categories
- rewrite slug:
articles
(same with my cpt)
Currently my URL is like this:
-
example.com/articles
–>archive-articles.php
(it works) -
example.com/articles/taxo-parent
–>taxonomy.php
(it works) -
example.com/articles/taxo-child
–>taxonomy.php
(it works) -
example.com/articles/post-title
–> I usesingle-articles.php
, it doesn’t work
I want my URL to be like this:
-
example.com/articles
-
example.com/articles/taxo-parent
-
example.com/articles/taxo-parent/taxo-child
-
example.com/articles/taxo-parent/taxo-child/post-title
It’s been a week working with this case and search / reading post from google but still have no luck, really appreciate if you guys could help me.
Thanks
EDIT:
I use WP Custom Post Type UI plugin to create custom post type and custom taxonomy
I have used my jewelery post type bellows code, You can just replace your post type & taxonomy. Just copy & paste on your functions file.
It works nicely my site according to your question.
You can not name
custom post_type
name andtaxonomy slug
same because when you work on taxonomy it will work asBut for post_type articles it will go with same url
So this make conflict in the url’s of taxonomy and post_type because initial url is same for both of them
You should update your permalink option after registering post type.
http://codex.wordpress.org/Function_Reference/flush_rewrite_rules
Than it should work.