I have been searching around but i cant anywhere find the answer to my question: How to change the post slug for all posts (and the categories etc.). Without affecting other pages/ custom post urls. So i want to change the url for default posts from:

url/postname > url/news/postname

Without affecting page urls and or custom post type urls. The only method i have so far found that achieved what i was looking for was:


add_action( 'init', 'my_new_default_post_type', 1 );
function my_new_default_post_type() {

register_post_type( 'post', array(
    'labels' => array(
        'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
    'public'  => true,
    '_builtin' => false, 
    '_edit_link' => 'post.php?post=%d', 
    'capability_type' => 'post',
    'map_meta_cap' => true,
    'hierarchical' => false,
    'rewrite' => array( 'slug' => 'post' ),
    'query_var' => false,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
) );

By re-registering the post type. But this also has the side effect that it creates a second menu item on the left side of the admin panel called post. They both contain the same data though.

Hopefully somebody has an answer to this problem.


There is no need to reregister the default post post type. You can just add a prefix to the permalink structure using the Permalinks settings, found under the main Settings menu in your WordPress administration panel:

Example of the permalinks settings

  • And this wont change all the urls for the pages? (cant try it at this current moment so) – N.Schipper Jul 1 '13 at 22:18
  • 1
    Correct. The default WordPress pages will just use domain.tld/page-slug as they always do. – Coen Jacobs Jul 2 '13 at 8:11
  • Yes that indeed did the trick. Thank you very much :) – N.Schipper Jul 2 '13 at 8:53
  • 3
    Make sure to set "with_front" to "false" on Custom Post Type initializations to avoid having the "blog" prefix on your Custom Post Types. – Aternus May 26 '15 at 9:24
  • Thx, Aternus. Also, after setting with_front to false, go to /wp-admin/options-permalink.php in the backend (just visit the page once) - this will call flush_rewrite_rules() after which the new links will work correctly – Frederik Struck-Schøning Nov 22 '15 at 20:34

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.