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( 

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' );
  • 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?

  • 1
    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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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