Yes this is possible using add_rewrite_rule()
, something along the lines of
add_rewrite_rule(
'test-subject/(\d+)/?',
'index.php?post_type=CPT_slug&post_id=$matches[1]'
);
add_rewrite_rule(
'ts/(\d+)/?',
'index.php?post_type=CPT_slug&post_id=$matches[1]'
);
It might be a bit trickier though, since test-subject/test-title
and test-subject/post_id
are quite similar. Adding the post_id
-rule with the 3rd argument as 'top'
might help.