Title: Custom post type permalink rewrite
Last modified: August 19, 2016

---

# Custom post type permalink rewrite

 *  [hydroplane](https://wordpress.org/support/users/hydroplane/)
 * (@hydroplane)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/)
 * I’ve set my custom permalink structure as [http://site.com/%postname%/](http://site.com/%postname%/)
   but despite this the permalinks for custom post type result in [http://site.com/custom-post-type/%postname%/](http://site.com/custom-post-type/%postname%/)
 * How can I get rid of the custom-post-type part?

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [16 years, 1 month ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461395)
 * Can you be more specific as to what, precisely, custom-post-type is? Like actual
   examples of REAL urls. If it’s what I think, then that feature is as designed.
   But I want to be sure 🙂
 * Also, having your permalinks be %postname% is a bad idea.
 * For details, read [http://ottopress.com/2010/category-in-permalinks-considered-harmful/](http://ottopress.com/2010/category-in-permalinks-considered-harmful/)
 *  [ickatanet](https://wordpress.org/support/users/ickatanet/)
 * (@ickatanet)
 * [16 years ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461610)
 * hydroplane: try to add empty string for the slug prefix when registering your
   post type:
 *     ```
       register_post_type('my_custom_post_type', array(
       	//...
       	'rewrite' => array('slug'=>'','with_front'=>false),
       	//...
       ));
       ```
   
 *  [granulr](https://wordpress.org/support/users/granulr/)
 * (@granulr)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461627)
 * I’m also looking for a solution to this problem… When you add an empty string
   like the above example I get a 404 page. Even after reseting permalnks.
 *  [Jacob Dubail](https://wordpress.org/support/users/jacobdubail/)
 * (@jacobdubail)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461636)
 * I have the same exact problem. Does anyone have a solution? I can rewrite the
   slug to be a single character, but that’s not going to fly. If my regular posts
   can follow this permalink structure, why can’t custom post types?
 *  [richarduk](https://wordpress.org/support/users/richarduk/)
 * (@richarduk)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461647)
 * I can confirm that (in my case) IckataNET has the right answer. Resaving permalinks
   works.
 * .htaccess not rewritable? CMOD 666
 *  [Jacob Dubail](https://wordpress.org/support/users/jacobdubail/)
 * (@jacobdubail)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461648)
 * I can confirm that IckataNET’s solution doesn’t work for me. I still get a 404
   after saving the permalinks anew.
 *  [Headway Marketing LLC](https://wordpress.org/support/users/headway/)
 * (@headway)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461655)
 * I had the same issue and found this post to be very helpful: ([http://wpengineer.com/2044/custom-post-type-and-permalink/](http://wpengineer.com/2044/custom-post-type-and-permalink/))
 * Re-saving the Permalinks structure in Settings fixed everything.
 *  [Zane Matthew](https://wordpress.org/support/users/zanematthew/)
 * (@zanematthew)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461664)
 * I can confirm that this:
 *     ```
       register_post_type('my_custom_post_type', array(
       	//...
       	'rewrite' => array('slug'=>'','with_front'=>false),
       	//...
       ));
       ```
   
 * did work for me.
 *  [security_man](https://wordpress.org/support/users/security_man/)
 * (@security_man)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461665)
 * I can confirm that IckataNET’s solution doesn’t work for me. I still get a 404
   after saving the permalinks anew.
 * I am pretty sure this has something to do with 3.04 as when i was using 3.0? 
   previously it worked fine.
 * The really odd thing is that one of my custom post types is working fine and 
   the other is not.
 * This is the register post type for the one that works:
 *     ```
       function my_custom_init()
       {
         $labels = array(
           'name' => _x('Websites', 'post type general name'),
           'singular_name' => _x('Website', 'post type singular name'),
           'add_new' => _x('Add New', 'website'),
           'add_new_item' => __('Add New Website'),
           'edit_item' => __('Edit Website'),
           'new_item' => __('New Website'),
           'view_item' => __('View Website'),
           'search_items' => __('Search Websites'),
           'not_found' =>  __('No Websites found'),
           'not_found_in_trash' => __('No Websites found in Trash'),
           'parent_item_colon' => ''
         );
         $args = array(
           'labels' => $labels,
           'public' => true,
           'publicly_queryable' => true,
           'show_ui' => true,
           'query_var' => true,
           'rewrite' => true,
           'capability_type' => 'post',
           'hierarchical' => false,
           'menu_position' => null,
           'taxonomies' => array( 'types','features'),
           'menu_position'=>5,
           'supports' => array('title','editor')
         );
         register_post_type('website',$args);
       }
       ```
   
 * and this is the one that doesnt work
 *     ```
       function create_qa_post_types() {
       	 $labels = array(
       		'name' => _x( 'FAQ Categories', 'taxonomy general name' ),
       		'singular_name' => _x( 'FAQ Category', 'taxonomy singular name' ),
       		'search_items' =>  __( 'Search FAQ Categories' ),
       		'all_items' => __( 'All FAQ Categories' ),
       		'parent_item' => __( 'Parent FAQ Category' ),
       		'parent_item_colon' => __( 'Parent FAQ Category:' ),
       		'edit_item' => __( 'Edit FAQ Category' ),
       		'update_item' => __( 'Update FAQ Category' ),
       		'add_new_item' => __( 'Add New FAQ Category' ),
       		'new_item_name' => __( 'New FAQ Category Name' ),
         );
         	register_taxonomy('faq_category',array('qa_faqs'), array(
       		'hierarchical' => true,
       		'labels' => $labels,
       		'show_ui' => true,
       		'query_var' => true,
       		'rewrite' => array( 'slug' => 'faq-category' ),
         ));
       	register_post_type( 'qa_faqs',
       		array(
       			'labels' => array(
       				'name' => __( 'FAQs' ),
       				'singular_name' => __( 'FAQ' ),
       				'edit_item'	=>	__( 'Edit FAQ'),
       				'add_new_item'	=>	__( 'Add FAQ')
       			),
       			'public' => true,
       			'show_ui' => true,
       			'capability_type' => 'post',
       	//...
       	'rewrite' => true,
       	//...
       			'taxonomies' => array( 'FAQs '),
       			'supports' => array('title','editor')
       		)
       	);
       }
       ```
   
 * Even if i make them identical one will work and the other does not. this is truly
   odd and frustrating.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Custom post type permalink rewrite’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [url rewrite](https://wordpress.org/support/topic-tag/url-rewrite/)

 * In: [Alpha/Beta/RC](https://wordpress.org/support/forum/alphabeta/)
 * 9 replies
 * 9 participants
 * Last reply from: [security_man](https://wordpress.org/support/users/security_man/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/custom-post-type-permalink-rewrite/#post-1461665)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
