I want to add /post/
to the default post post type url. I have tried it by register the 'post' post type as follows:
function fdm_register_post_types() {
// Get post post type object
$object = get_post_type_object( 'post' );
// Set rewrite argument
$object->rewrite = array( 'slug' => 'post', 'with_front' => false );
// Reregister post type
register_post_type( 'post', $object );
}
add_action( 'init', 'fdm_register_post_types' );
No success.
According to this Stack post, you need to set the permalink structure (under settings -> permalinks) to /post/%postname%/
and set other post types rewrite argument to:
'rewrite' => array('slug' => 'post_type_name', 'with_front' => false),
This works fine, but when I visit my author pages now. I can only visit them like /post/author/name/
and not /author/name/
.
Is there a better solution for editing the 'post' post type or should I change something in the author functionality?