i want to ask you about something that i really confuse to solve. I have a problem with my wordpress site, it has duplicated URL with the same result.
- www.site.com/some-blog-post
- www.site.com/news/some-blog-post
I got the number 2, when i modified my themes functions :
add_action( 'init', 'add_news_slug_permalink', 1 );
function add_news_slug_permalink() {
register_post_type( 'post', array(
'rewrite' => array( 'slug' => 'news' ),
) );
}
The question is, how to redirect or disabled URL without news
slug to URL with news
slug?
Thanks.
I got the solution, in this case, i add an action in my
function.php
, it’s like :