Your setup is all over the place. Lets refer to the visual overview here:
http://codex.wordpress.org/Template_Hierarchy#Visual_Overview
Your page is going to use the page.php
template.
Your custom post type weine
will use single-weine.php
Your custom taxonomy sorte
( probably not the best name as it might clash ) will use the template taxonomy-sorte.php
So we can expect by default to have a weine post with the title “example” to live at:
example.com/weine/example
and the sorte
taxonomy term ‘examplesorte’ will have its archive at:
example.com/sorte/examplesorte
What I expect you’re trying to do is change it so that there is no /weine/
, or you think that by using postname that it will change the link of ‘weine’ posts. This is incorrect, and while there is code out there that may change this, I strongly recommend against this as it introduces dangerous permalink clashes. It’s also better if you use the weine
URL structure to your advantage.
e.g. I would recommend modifying the rewrite base of the sorte
taxonomy to use weine/sorte
as it’s base, giving you URLs such as:
example.com/weine/sorte/examplesorte
A Note On Flushing Rewrites
You need to flush them when your custom post types and taxonomies change, but never do it on admin_init
or init
. Regenerating rewrite rules is slow and expensive, and by putting it on those hooks, you’re massively slowing down your site, and introducing potential bugs and problems.
I would also kill trying to set custom post types parents as that of a normal page. Use the slug in the rewrite base but go no further than that.