It's now several hours that I am trying to get this done without finding a proper solution.
WHAT I WANT TO ACHIEVE
I'd like WP to use the following URL structure:
1) Posts -> /%category%/articles/%postname%/ 2) CPT -> /%category%/CPT/%postname%/
Where the %category% bit is the default categories taxonomy used in the Posts
WHAT I DID SO FAR
To add the default categories taxonomy to the CPT, this bit has been added while registering the CPT
'taxonomies' => array('category'),
whereas the followings are the rewrite args
$rewrite_args = array( 'slug' => '%category%/test', 'with_front' => false, 'feeds' => false, 'pages' => false );
CHANGING THE DEFAULT POST
I know the most obvious solution is to change the permalink structure in the setting panel. And this need to be done in any case otherwise anything I will describe will work.
So my Permalink structure has been set as
If I leave the basic configuration, no hooks, anything. Posts works as expected.
At the time I hook on the post_type_link to make my CPT replacing the %category%, the default configuration stops working.
I tried to re-register the Posts type; this seems to give better results (though there is the inconvenience to see the "posts" item twice in the admin bar), but for some reason when I do this, the CPT custom slug stops working.
Do you have any specific hint? Thanks Andrea