Logic
- I have a page template at
/blog
that contains a "public" blog. - I have a page template at
/members
that is members area.
If a user enters the URL /members/blog
I want to catch this in the template_redirect
hook and load up a custom template that shows a "private" blog
Problem
Before template_redirect
is called /members/blog
is re-written to /blog
so I can't load the private blog page.
There is nothing in the rewrite rules that says to do this.
/members/blog
a page?redirect_guess_404_permalink
. It finds your blog page and redirects there. The simplest solution is to just add a page so it doesn't 404.redirect_canonical
is what you'd need to do. If you search around for that you might find something. The action is added inwp-includes/default-filters.php
.