I'm trying to use WP Rewrite to avoid having to enter anything into an htaccess file. So far, I have this one working just fine (it loads a post from a Custom Post Type):
$leader_structure = 'performance/leaders/%leader%'; $wp_rewrite->add_rewrite_tag("%leader%", '([^/]+)', "leader="); $wp_rewrite->add_permastruct('leader', $leader_structure, false);
Basically, if you go to http://domain.com/performance/leaders/some-slug-here, it'll properly load the content from http://domain.com?leader=some-slug-here.
However, when I try it again with a non-custom-post-type (just normal WP posts), I can't get it to work. Here's what I'm doing:
$scenarios_structure = 'our-thinking/scenarios/%post%'; $wp_rewrite->add_rewrite_tag("%post%", '([^/]+)', "name="); $wp_rewrite->add_permastruct('scenarios', $scenarios_structure, false);
So here, I want it so that http://domain.com/our-thinking/scenarios/some-post-slug should load the single WP post. But it doesn't. When I go to that URL, it redirects to http://domain.com/some-post-slug.
It's probably plainly obvious what I'm doing wrong to someone else, but I'm just not getting it. My WordPress permalink settings are set to "Post name". And my .htaccess file is untouched.