It works for me.
add_filter('post_link', 'locale_permalink', 10, 3);
add_filter('post_type_link', 'locale_permalink', 10, 3);
function locale_permalink($permalink, $post_id, $leavename) {
if (strpos($permalink, '%category_slider%') === FALSE) return $permalink;
$post = get_post($post_id);
if (!$post) return $permalink;
if ($post->post_type != 'post') {
return $permalink;
} else {
$terms = wp_get_object_terms($post->ID, 'category_slider');
if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
else $taxonomy_slug = 'news';
return str_replace('%category_slider%', $taxonomy_slug, $permalink);
}
}
add_filter('rewrite_rules_array','remove_bare_folder_rule');
function remove_bare_folder_rule( $rules )
{
unset($rules['([^/]+)/?$']);
return $rules;
}