Opened 16 years ago
Closed 16 years ago
#12597 closed defect (bug) (fixed)
404 when viewing an attachment or paginated custom post type
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 3.0 | Priority: | normal |
| Severity: | normal | Version: | 3.0 |
| Component: | Posts, Post Types | Keywords: | needs-testing |
| Focuses: | Cc: |
Description
Has anyone gotten attachments and pagination to work for custom post types? This doesn't seem to be working for me, and I think it's something we may have overlooked.
Let's suppose I have a post type called movies. The permalink structure looks like this for a single movie:
localhost/movies/good-will-hunting
Now, let's say this is a long article and I want to split it into multiple pages. I'd use the <!--nextpage--> tag for this in the post editor. This gives me a page 2 to click on:
localhost/movies/good-will-hunting/2
I'm getting a 404 here.
Now, let's suppose I want to use the [gallery] shortcode to display some images. When clicking on an image, the URL is:
localhost/movies/good-will-hunting/robin-williams
This also results in a 404.
I'd venture to say that <!--nextpage--> isn't used too often, but image attachments are pretty important.
Currently generated Rewrite rules for custom post_types:
'note/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?note=$matches[1]&feed=$matches[2]' (length=43) 'note/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?note=$matches[1]&feed=$matches[2]' (length=43) 'note/([^/]+)/page/?([0-9]{1,})/?$' => string 'index.php?note=$matches[1]&paged=$matches[2]' (length=44) 'note/([^/]+)/?$' => string 'index.php?note=$matches[1]' (length=26)Lacks ALL endpoints (Aside from ugly paging and feeds).
Rules generated afterwards:
'note/[^/]+/attachment/([^/]+)/?$' => string 'index.php?attachment=$matches[1]' (length=32) 'note/[^/]+/attachment/([^/]+)/trackback/?$' => string 'index.php?attachment=$matches[1]&tb=1' (length=37) 'note/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?attachment=$matches[1]&feed=$matches[2]' (length=49) 'note/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?attachment=$matches[1]&feed=$matches[2]' (length=49) 'note/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$' => string 'index.php?attachment=$matches[1]&cpage=$matches[2]' (length=50) 'note/([^/]+)/trackback/?$' => string 'index.php?note=$matches[1]&tb=1' (length=31) 'note/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?note=$matches[1]&feed=$matches[2]' (length=43) 'note/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?note=$matches[1]&feed=$matches[2]' (length=43) 'note/([^/]+)/page/?([0-9]{1,})/?$' => string 'index.php?note=$matches[1]&paged=$matches[2]' (length=44) 'note/([^/]+)(/[0-9]+)?/?$' => string 'index.php?note=$matches[1]&page=$matches[2]' (length=43) 'note/[^/]+/([^/]+)/?$' => string 'index.php?attachment=$matches[1]' (length=32) 'note/[^/]+/([^/]+)/trackback/?$' => string 'index.php?attachment=$matches[1]&tb=1' (length=37) 'note/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?attachment=$matches[1]&feed=$matches[2]' (length=49) 'note/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => string 'index.php?attachment=$matches[1]&feed=$matches[2]' (length=49) 'note/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$' => string 'index.php?attachment=$matches[1]&cpage=$matches[2]' (length=50)Seems to cover all the bases mentioned here along with everything else thats not.
Leaving open seeking testing feedback.
Note to developers: You'll need to flush your rewrite rules after this changeset to see any improvement.