I'm trying to change the default slug
for default wordpress post
.
With register_post_type
works fine with this code:
add_action( 'init', 'my_new_default_post_type', 1 );
function my_new_default_post_type() {
register_post_type( 'post', array(
'rewrite' => array( 'slug' => 'blog' ),
) );
}
But with recent register_post_type_args
is not possible. This is my code:
add_filter( 'register_post_type_args', 'new_register_post_type_args', 10, 2 );
function new_register_post_type_args( $args, $post_type ) {
if ( 'post' === $post_type ) {
$args['rewrite']['slug'] = 'blog';
}
return $args;
}
Any ideas?
$args['rewrite'] = array('slug' => 'blog');
$args['rewrite']['slug'] = 'blog'