WordPress – How to change Post Post Type Slug
If you want to change the slug of the Post post type to something like /posts/my-story/, there is no default way in the WordPress settings. Changing the Permalink settings will changes Pages as well.
There is the hook register_post_type_args, which allows you to hook into a registering post_type and update values there. But updating the rewrite parameter for the post post-type does not work here for some reason.
So instead we can do something else. Redeclare the post post-type.
Yes, that’s right, simply declare it again.
add_action( 'init', 'redefine_post', 1 ); function redefine_post() { register_post_type( 'post', [ 'labels' => [ '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, 'menu_position' => 5, 'menu_icon' => 'dashicons-admin-post', 'hierarchical' => false, 'rewrite' => array( 'slug' => 'post' ), 'query_var' => false, 'delete_with_user' => true, 'supports' => [ 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ], 'show_in_rest' => true, 'rest_base' => 'posts', 'rest_controller_class' => 'WP_REST_Posts_Controller', ] ); }