With @Caleb‘s help we’ve sorted this. The main problem was that the rewrite
parameter on the custom taxonomies was not set to false
. Doing this removed /articles/
from the permalinks to these archives.
We changed this:
$rewrite = isset( $taxonomy['rewrite'] ) ? $taxonomy['rewrite'] : array( 'slug' => $taxonomy['slug'] );
$hierarchical = isset( $taxonomy['hierarchical'] ) ? $taxonomy['hierarchical'] : true;
register_taxonomy( $taxonomy['slug'], $taxonomy['post_type'], array(
'hierarchical' => $hierarchical,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => $rewrite,
));
To this:
$rewrite = isset( $taxonomy['rewrite'] ) ? $taxonomy['rewrite'] : array( 'slug' => $taxonomy['slug'] );
$rewrite['with_front'] = false; // new line
$hierarchical = isset( $taxonomy['hierarchical'] ) ? $taxonomy['hierarchical'] : true;
register_taxonomy( $taxonomy['slug'], $taxonomy['post_type'], array(
'hierarchical' => $hierarchical,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => $rewrite,
));
This means I was able to adjust the permalink settings to achieve the results I required using the Category/Tag base fields and the Custom Structure field under Settings -> Permalinks in the WP Admin as usual.
The remaining issues were actually due to a setting buried in the Yoast SEO plugin. They have moved the setting which strips the category base to Settings -> Categories – > Additional Settings.
Huge thanks to @Caleb for the help here.