Title: Custom Post Type Rewrite Permalink
Last modified: August 31, 2016

---

# Custom Post Type Rewrite Permalink

 *  [Floppy78](https://wordpress.org/support/users/floppy78/)
 * (@floppy78)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite-permalink/)
 * Hi everyone!
    I’m working with a premium theme in which was developed a plugin
   for custom post types. The site presents a listing of events and locations. I’d
   like to change the permalink structure for SEO purposes and maybe I’m not so 
   experienced in coding to understand how to achieve my goal (if possible).
 * This is the code for events categories:
 *     ```
       register_taxonomy(
       				'event_cat',
       				'event',
       				array(
       					'public'=>true,
       					'hierarchical' => true,
       					'labels'=> $labels,
       					'query_var' => 'event_cat',
       					'show_ui' => true,
       					'rewrite' => array( 'slug' => 'event_cat', 'with_front' => false ),
       				)
       			);
       ```
   
 * And this is the permalink output:
    [http://www.vadoper.it/demo/event_cat/concerto-dal-vivo/](http://www.vadoper.it/demo/event_cat/concerto-dal-vivo/)
   I’d like to get rid of this “event_cat” (I was expecting to see it substituted
   by the category name, but this is appended after “event_cat” instead) just to
   have a simple permalink for categories like [](http://www.vadoper.it/demo/concerto-dal-vivo/).
 * Maybe I’m missing something about the theme architecture and, even for instructive
   purposes, I hope someone could help me understand more about these permalinks.
 * My try has been changing the “rewrite” code with `'rewrite' => array( 'slug' 
   => '', 'with_front' => false ),`
    re-save permalinks (actually setted to /%postname%/)
   but it isn’t working.. Thank you!

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite-permalink/#post-7328244)
 * You need to have some sort of constant text for the rewrite rule to be able to
   identify that the permalink is for a custom taxonomy term and not, for example,
   a post title. It doesn’t need to exist in front of the term, but it needs to 
   exist somewhere.
 * It’s possible to have positionally based permalinks, but then that position must
   always be attributed to the taxonomy term no matter what. In such a case you 
   are creating a custom permastruct with a custom tag instead of a normal rewrite
   rule.
 * I don’t know if it would help with SEO, but you could add the term as an URL 
   parameter instead of creating a permalink, i.e. `index.php?event_cat=5` (5 is
   an example term ID), then register the URL parameter in Google Search Console.
   Bing Webmaster Tools should have something similar. Of course this only helps
   with search engines where the parameter is registered.
 * Implementing any of these variants could involve hacking the theme or it’s plugin.
   This would be problematic because your changes could be lost when the theme or
   plugin is updated. Ideally, you need to achieve your changes through your own
   plugin that hooks various actions and filters to achieve your goals.

Viewing 1 replies (of 1 total)

The topic ‘Custom Post Type Rewrite Permalink’ 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: [9 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite-permalink/#post-7328244)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
