Title: Personalized permalink
Last modified: August 30, 2016

---

# Personalized permalink

 *  Resolved [giancarlo.braga](https://wordpress.org/support/users/giancarlobraga/)
 * (@giancarlobraga)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/personalized-permalink/)
 * Hi!
 * I need help.
 * Considering My permalink in configuration section is:
    /News/%post_id%/%post_name%/
   Yes..”news” is fixed….(its a kind of site migration and i need to keep those 
   uRLs because of the SEO and google rank)…
 * And i really need the “post id” in the middle of url..It works well with regular
   posts..but this way is very ugly..But when a created a post type..the URL output
   was that:
 * /News/news/somepostslug..the post id just gone!!
    I tried to change permalink
   configs this way: /%post_id%/%post_name%/
 * And then the URL output was that:
    /news/somepostslug
 * Would be ok..in normal case..but not in mine.
 * I need to personalize it…cuz the id..
    I just would like to remove /News/ from
   permalink section and use this as post type created in your plugin…obviously 
   is the right way..and i need this..
 * After that test, i tried to use /%post_id/ inside your plugin post type slug 
   configurations..but no sucess at all..this way: /news/%post_id%/ and uRL output
   was:
    /news/%post_id%/somepostslug…Even worse.. 🙁
 * I need the URL this way:
    /news/99999/postslug(using your plugin by creating “
   news” post type)….
 * How can i do it??
 * Thanks a lot
 * [https://wordpress.org/plugins/custom-post-type-ui/](https://wordpress.org/plugins/custom-post-type-ui/)

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

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [10 years, 5 months ago](https://wordpress.org/support/topic/personalized-permalink/#post-6867849)
 * Definitely going to be some custom rewrite api setups from best I can tell. Our
   plugin doesn’t dive into that area, to be honest. We focus on what gets passed
   into `register_post_type` and `register_taxonomy` functions.
 *  [amandathewebdev](https://wordpress.org/support/users/amandathewebdev/)
 * (@amandathewebdev)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/personalized-permalink/#post-6868006)
 * Hello there,
 * I had a similar issue and I had to do a rewrite. Maybe try this in your functions.
   php file:
 *     ```
       add_filter('post_type_link', 'my_rewrite', 1, 3);
   
       function my_rewrite( $link, $post = 0 ){
           if ( $post->post_type == 'news' ){
               return home_url( 'news/' . $post->ID );
           } else {
               return $link;
           }
       }
   
       add_action( 'init', 'my_rewrite_init' );
   
       function my_rewrite_init(){
           add_rewrite_rule(
               'news/([0-9]+)?$',
               'index.php?post_type=news&p=$matches[1]',
               'top' );
       }
       ```
   

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

The topic ‘Personalized permalink’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

 * 2 replies
 * 3 participants
 * Last reply from: [amandathewebdev](https://wordpress.org/support/users/amandathewebdev/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/personalized-permalink/#post-6868006)
 * Status: resolved