Title: Custom post type taxonomy URL changes
Last modified: August 21, 2016

---

# Custom post type taxonomy URL changes

 *  [Leaniebiz](https://wordpress.org/support/users/leaniebiz/)
 * (@leaniebiz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-taxonomy-url-changes/)
 * Hello huys,
 * I have a custom post type and in this custom post type I did setup taxonomy support.
   My code so far is like this:
 *     ```
       function create_post_type() {
       register_post_type( 'CPT',
       		array(
               	'labels' => array(
                   'name' => __( 'CPT' ),
                   'singular_name' => __( 'CPT' )
       		),
       	        'public' => true,
       	        'has_archive' => true,
       			'menu_position'=>5,
       			'hierarchical' => true,
       			'rewrite' => true,
       			'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields' ),
       		)
       		);
       		register_taxonomy( "CPT", array("CPT"), array("hierarchical" => true, "label" => "Category CPT", "singular_label" => "CPT" ));
       }
       ```
   
 * The problem I have is when I check a category at a post in the custom post type,
   the post gets the category linked but the URL does’t change.
 * I want to use a filter posts by using a; order by category in the custom post
   type.
 * Anyone can tell me what I need to do to see the url structure like this:
    _[http://www.sitename.com/cpt/category-name/post-name](http://www.sitename.com/cpt/category-name/post-name)_
 * I hope someone can help me with this issue since now there is no new URL created
   but in the menu I got a possibility to add:
    _[http://www.sitename.com/cpt/post-name/category-name](http://www.sitename.com/cpt/post-name/category-name)_
 * But this link will redirect to a 404page.

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-taxonomy-url-changes/#post-3795532)
 * You can use the [Rewrite API](http://codex.wordpress.org/Rewrite_API) to tell
   WP the element after /cpt/ is a category variable and that the element after 
   that is the post name.

Viewing 1 replies (of 1 total)

The topic ‘Custom post type taxonomy URL changes’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-taxonomy-url-changes/#post-3795532)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
