WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to append the URL when viewing a single post. For example when im on a post I want the url to be something like: example.com/mypage/mypage/single-post-article

The default url is example.com/single-post-article

I did not find something here on WPSE or the goooglz, but I have read about wp-rewrite and tried add_post_type_support to the post but no luck!

add_post_type_support( 'post', array(
   'rewrite' => array('slug' => '/bla/bla/')

Do I need to use wp_rewrite?


I did get this to work by run register_post_type on the post_type "post" again. But is this the best way?

  register_post_type( 'post', array(
        'public'  => true,
        '_builtin' => false, 
        '_edit_link' => 'post.php?post=%d', 
        'capability_type' => 'post',
        'map_meta_cap' => true,
        'hierarchical' => false,
        'rewrite' => array( 'slug' => '/mypage/mypage' ),
        'query_var' => false,
        'pages'     => false,
        'supports' => array( 
share|improve this question
up vote 8 down vote accepted

Go to your Settings > Permalinks page and set your permalinks to:


If you don't want categories to append /mypage/mypage, you can change their permastruct:

function wpa85084_category_permastruct(){
    global $wp_rewrite;
    $wp_rewrite->extra_permastructs['category']['struct'] = '/category/%category%';
add_action( 'init', 'wpa85084_category_permastruct' );
share|improve this answer
Thats awesome, thanks! – Pontus Abrahamsson Feb 11 '13 at 8:29
one remark regarding Milo answer, i tryed it, it work's but how about the author, tags ...etc the permalink structure affect all the website not only the posts, so how to restrict it to only posts ? – user48881 Mar 13 '14 at 7:42

Did you try flushing your rewrite rules after you defined them?

share|improve this answer
You should always add a caveat with this that it should only be done once, so doing it via code is dangerous. Personally, I always flush my rewrites by updating the permalinks on the permalinks settings page. – Matthew Boynes Feb 14 '13 at 19:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.