#16626 closed defect (bug) (fixed)
CPT archive rewrite rule doesn't respect 'with_front' arg
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.1.1 |
| Component: | Post Types | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: | nacin, azizur |
Description (last modified by scribu)
- 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)
- 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
- Keywords has-patch added
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.
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 ), ... ) );
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
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.
- Owner set to scribu
- Status changed from new to reviewing
Follow-up: #16725
comment:10
azizur — 2 years ago
- Cc azizur added
comment:11
markjaquith — 2 years ago
- Resolution set to fixed
- Status changed from reviewing to closed

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.