-
Change the rewrite slug in your post type registration to
hebammen/%location%
-
Delete the whole
smc_add_rewrite_rules
function. - Add a filter to
query_vars
to register thelocation
query var. - Change the
smc_permalinks
function to only replace%location%
, the postname will automatically be inserted.