Change permalinks for post type ‘post’ only

I found the answer here. Remember to pop in there and give it a like.

I’ll post it here, for people in a rush.


Put this into the functions.php-file:

function wp1482371_custom_post_type_args( $args, $post_type ) {
  if ( $post_type == "post" ) {
    $args['rewrite'] = array(
      'slug' => 'blog'
    );
  }

  return $args;
}
add_filter( 'register_post_type_args', 'wp1482371_custom_post_type_args', 20, 2 );

(Tested and works).

Remember!!

Remember A) Remember to update your permalinks afterwards (by going into Settings >> Permalinks >> Click ‘Save Changes’ ).

Remember B) If you get wierd results, then try opening an incognito-window and see if it words there. WordPress has a feature that redirects to ‘Nearest Matching URL‘, that can seem confusing, when playing around with permalinks.


You could also try to find a Plugin that does it. I wouldn’t do that, since it’s quite extensive to add a plugin for that sole purpose. But hey, – sometimes it can be satisfying to shoot birds with canons (no bird was harmed making this joke).

Leave a Comment

tech