I think the only (the easiest) solution is to change permastruct
s for custom post types after registering them and add your 'magic word' to permalink structure.
So set (in parmalinks settings) your permalink structure to: /my-magic-word/%postname%/
and then manually modify permastructs of your custom post types.
You can do this like so (add it to your functions.php file):
function my_init() {
global $wp_rewrite;
// Let's assume you register your CPT Books in here
$args = array( 'public' => true, 'label' => 'Books' );
register_post_type( 'book', $args );
// after registering your CPT, you have to change it's permastruct
$wp_rewrite->extra_permastructs['book']['struct'] = "book/%book%"; // it's without 'my-magic-word' - you should do this for every CPT that should not have 'my-magic-word' in url
}
add_action('init', 'my_init');
Then go to permalink settings and save them to flush rewrite rules.
PS. I think you could try to use with_front
param, but I'm not sure if it will be easier (or if it even will work) than this solution.