#16626 closed defect (bug) (fixed)
CPT archive rewrite rule doesn't respect 'with_front' arg
Reported by: | scribu | Owned by: | scribu |
---|---|---|---|
Milestone: | 3.1.1 | Priority: | normal |
Severity: | normal | Version: | 3.1 |
Component: | Posts, Post Types | Keywords: | has-patch commit |
Focuses: | Cc: |
Description (last modified by )
- Have WP MS activated, with subdirectories, not subdomains.
- Register a custom post type, with has_archive => true.
- On the main blog, call get_post_archive_link().
The URL will include the /blog/ prefix, but it will lead to a 404, since the rewrite rule isn't correct.
Attachments (2)
Change History (14)
#1
@
14 years ago
- Description modified (diff)
- Summary changed from get_post_archive_link() includes /blog/, when it shouldn't to CPT archive rewrite rule doesn't respect 'with_front' arg
#3
@
14 years ago
Seems that 16626.diff does work. When I previously rec'd a 404 not found error when trying to load a single custom post type. When I used your diff, I am now able to see the post. still uses the /blog url structure, which is another issue though.
#4
@
14 years ago
still uses the /blog url structure, which is another issue though.
Yes, that's the idea. If you don't want to use /blog, just say so:
register_post_type( ..., array( 'rewrite' => array( 'with_front' => false ), ... ) );
#5
@
14 years ago
seems that using 16626.diff caused this error though.
Fatal error: Cannot redeclare class Walker_Page in /.../wp-includes/post-template.php on line 1062
#7
@
14 years ago
Walker_Page was moved from wp-includes/classes.php (and that file was killed) to wp-includes/post-template.php. I would make sure your upgrade was complete.
The trouble comes from the fact that
$wp_rewrite->add_rule()
is used directly, which doesn't have a $with_front argument.See 16626.diff.