How can I force permalinks on my posts?

I’ve got a news section which I’ve renamed from “posts” but now I’d like to create permalinks for this section. Note that I’m using the “Post Name” Permalink structure, but also as part of the Custom Post Types setup, I’ve rewritten the “slug” for these. How can I go about altering the slug for the “post” type too?

Here is the code I have so far which only masks the URL i.e. it’s still accessible if I remove the “film-news” part which I presume is not good for SEO since it would presumably count as being a duplicate URL.

Any thoughts please?

add_filter('pre_post_link', 'my_change_post_link', 10, 3);
function my_change_post_link($permalink, $post, $leavename)
{
	if (get_post_type($post) == 'post') {
		return "/film-news" . $permalink;
	}
	return $permalink;
}

Thanks!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.