-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
walk_dirs arg for add_permastruct() #52
Comments
Thanks! It's been a long while since I implemented a post type that used any of the date parameters in its permastructure, so it's likely that I missed this. I think it would be expected behaviour that if your post type permastructure includes dates then the corresponding date archives are also available. I'll have a look into this when I have some free time to work on it. |
By manually setting walk_dirs to false, I realized that the example I provided above actually generates an extra 12 rewrite rules:
|
This also makes |
It looks like you are currently calling
add_permastruct
without setting$args['walk_dirs']
which means you end up using the core default oftrue
.Because of this, when setting a permastruct like
/slug/%year%/%monthnum%/%postname%
you also get the following rules:While it would be great to have date based archives for custom post types, we are not actually setting the
post_type
query var so we end up with a second URL where we can view the date archives for the corepost
post-type.I don't see an easy way to force the
post_type
query variable short of filtering$this->post_type . '_rewrite_rules'
and manually modifying it (though admittedly I am not very familiar with the rewrite API).Anyway - I guess I am wondering what your thoughts are about all of this? At a minimum, I would think it would be beneficial to set
$this->defaults['rewrite']['walk_dirs']
tofalse
to avoid duplicate content.At the same time, it would be great to further mimic some of the core functionality such as date based archives when the user sets a permastruct which includes date and time rewrite tags.
The text was updated successfully, but these errors were encountered: