function custom_remove_post_type_slug($post_link, $post) {
if (is_object($post) && in_array($post->post_type, ['photography', 'filmmaking'])) {
if ($post->post_status === 'publish' || $post->post_status === 'future') {
$post_link = home_url('/' . $post->post_name);
}
}
return $post_link;
}
add_filter('post_type_link', 'custom_remove_post_type_slug', 10, 2);
function custom_parse_request($query) {
if (!$query->is_main_query()) {
return;
}
if (isset($query->query['name']) && !isset($query->query['post_type'])) {
$name = $query->query['name'];
$query->set('post_type', ['post', 'photography', 'filmmaking']);
}
}
add_action('pre_get_posts', 'custom_parse_request');
site.com/news
/news
а только домен и название материала