here’s a way to add article type with tags.
First we add the taxonomy to our post
add_action('init', 'article_type_init');
function article_type_init() {
if (!is_taxonomy('article_type')) {
register_taxonomy( 'article_type', 'post',
array(
'hierarchical' => FALSE,
'label' => __('Article Type'),
'public' => TRUE,
'show_ui' => TRUE,
'query_var' => 'article-type',
'rewrite' => true ) );
}
}
Than we hook into the permalink generation, to be sure that we not receive 404 when we will try our new permalink structure
add_filter('post_link', 'article_type_permalink', 10, 3);
add_filter('post_type_link', 'article_type_permalink', 10, 3);
function rating_article_type($permalink, $post_id, $leavename) {
if (strpos($permalink, '%article-type%') === FALSE) return $permalink;
// Get post
$post = get_post($post_id);
if (!$post) return $permalink;
// Get taxonomy terms
$terms = wp_get_object_terms($post->ID, 'article_type');
if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
else $taxonomy_slug = 'not-rated'; // add a default tag...
return str_replace('%article-type%', $taxonomy_slug, $permalink);
}
Finaly go to your permalink structure (General|Permalink) and change it to :
/%article-type%/%postname%
And there you go, you’re now able to see tags as permalink !