I tried this solution for adding 'articles' prefix before blog posts on URL.
function filter_post_link($permalink, $post) {
if ($post->post_type != 'post')
return $permalink;
return 'articles'.$permalink;
}
add_filter('pre_post_link', 'filter_post_link', 10, 2);
function add_blog_rewrites( $wp_rewrite ) {
$wp_rewrite->rules = array(
'articles/([^/]+)/?$' => 'index.php?name=$matches[1]',
'articles/[^/]+/attachment/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
'articles/[^/]+/attachment/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
'articles/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'articles/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'articles/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
'articles/([^/]+)/trackback/?$' => 'index.php?name=$matches[1]&tb=1',
'articles/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?name=$matches[1]&feed=$matches[2]',
'articles/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?name=$matches[1]&feed=$matches[2]',
'articles/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?name=$matches[1]&paged=$matches[2]',
'articles/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?name=$matches[1]&cpage=$matches[2]',
'articles/([^/]+)(/[0-9]+)?/?$' => 'index.php?name=$matches[1]&page=$matches[2]',
'articles/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
'articles/[^/]+/([^/]+)/trackback/?$' => 'index.php?attachment=$matches[1]&tb=1',
'articles/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'articles/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?attachment=$matches[1]&feed=$matches[2]',
'articles/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => 'index.php?attachment=$matches[1]&cpage=$matches[2]',
) + $wp_rewrite->rules;
}
add_action( 'generate_rewrite_rules', 'add_blog_rewrites' );
Everything working fine except pagination cause problem, i got 404 error on "articles/page/2/" & so...
I don't want to put "/articles/%postname%/" on permalink since there are few different custom post, taxonomy etc.