Custom Permalinks with meta value not working. Why?

  1. Change the rewrite slug in your post type registration to hebammen/%location%

  2. Delete the whole smc_add_rewrite_rules function.

  3. Add a filter to query_vars to register the location query var.
  4. Change the smc_permalinks function to only replace %location%, the postname will automatically be inserted.