Make WordPress Core

Opened 14 years ago

Last modified 6 years ago

#16415 new enhancement

Don't require CPTs to have archives in order to have feeds

Reported by: aaroncampbell's profile aaroncampbell Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

When archives and feeds were added to custom post types (see #13818) it was set up so you had to have archives (has_archive) in order to have feeds (rewrite[feeds]).

There are some situations where it would be nice to have feeds but archives aren't needed.

Attachments (7)

16415.diff (2.1 KB) - added by aaroncampbell 14 years ago.
16415.2.diff (2.4 KB) - added by SergeyBiryukov 12 years ago.
16415.3.diff (3.6 KB) - added by aaroncampbell 12 years ago.
16415.4.diff (3.7 KB) - added by aaroncampbell 12 years ago.
16415.5.diff (3.8 KB) - added by aaroncampbell 12 years ago.
16415.6.diff (4.0 KB) - added by wonderboymusic 11 years ago.
16415.7.diff (3.9 KB) - added by wonderboymusic 9 years ago.

Download all attachments as: .zip

Change History (28)

@aaroncampbell
14 years ago

#1 @scribu
14 years ago

  • Keywords 2nd-opinion added

Could you give an example of such a situation?

#2 follow-up: @markmcwilliams
14 years ago

You would still need to use the has_archive though Aaron (even with your patch), unless I'm hugely mistaken? Take site.com/cpt-archive/feed/ for example, which gives you what it does currently, where would the /feed/ be if there was no archives? Or have I still missed something?

Unless you're on about doing site.com/cpt-rewrite-slug/feed/ if I follow?

#3 in reply to: ↑ 2 ; follow-up: @aaroncampbell
14 years ago

@scribu:
Sorry, I explained it all to Nacin but didn't get it into the ticket because it seemed long winded. The quick example is my beer review site. It has two CPTs...beer and beer-review. I'd like to have a feed for beer-review. Something that other sites could consume and show the kind of activity on my site. However, having an archive page of reviews for all different beer reviews really doesn't make any sense because they're just too random (however, I do have an archive page for beers).

The quick solution for me is to turn on archives for both and redirect the beer-review archives to the beer archives, but the correct solution is to allow feeds without archives.

The other oddity is the slugs. If the feed is at /beer-review/feed/ and you remove feed/ you'll get a 404 if there's no archive. However, if there's no archive the same is true of each review which would look like /beer-review/my-beer-review-slug/

@markmcwilliams: I tested it on trunk at the #wcphx dev day and it worked without has_archive. If you don't specify a has_archive slug it uses the rewrite slug.

#4 @nacin
14 years ago

  • Keywords 2nd-opinion removed

Keep in mind we originally just supported /slug/post-slug/, not /slug/. Allowing /slug/feed/ even when not supporting /slug/ makes more sense in that context.

I spoke with aaron and agreed this would be a nice enhancement. Better to be as flexible as people want when it's easy to introduce it.

#5 in reply to: ↑ 3 @markmcwilliams
14 years ago

Replying to aaroncampbell:

@markmcwilliams: I tested it on trunk at the #wcphx dev day and it worked without has_archive. If you don't specify a has_archive slug it uses the rewrite slug.

So I really ended up answering my own question! ;) And from that point of view (while I don't have a use for just the feed yet) it would be handy, like Nacin says.

#6 @aaroncampbell
12 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 3.5

#7 follow-up: @SergeyBiryukov
12 years ago

Refreshed the patch (16415.diff didn't apply cleanly).

Last edited 12 years ago by SergeyBiryukov (previous) (diff)

#8 in reply to: ↑ 7 @aaroncampbell
12 years ago

Replying to SergeyBiryukov:

Refreshed the patch (16415.diff didn't apply cleanly).

Thanks Sergey, it was on my TODO list but I hadn't got there yet. Looks good.

#9 @nacin
12 years ago

Seems like get_post_type_archive_feed_link() needs a modification.

#10 @aaroncampbell
12 years ago

16415.3.diff fixes get_post_type_archive_feed_link() for post types with feeds and no archive.

#11 @aaroncampbell
12 years ago

16415.4.diff only adds/removes the filter if it isn't already there.

#12 @aaroncampbell
12 years ago

16415.5.diff switches the filter to ignore_has_archive_$post_type which is better worded and allows you to pass a more logical __return_true to override.

#13 follow-up: @nacin
12 years ago

  • Keywords 3.6-early added
  • Milestone changed from 3.5 to Future Release

I have some ideas here. Punting as this can be done by manually adding rules for now.

#14 @helen
12 years ago

  • Milestone changed from Future Release to 3.6

#15 @sabreuse
12 years ago

  • Cc sabreuse added

#16 @ryan
12 years ago

  • Milestone changed from 3.6 to Future Release

#17 @aaroncampbell
12 years ago

I see that we punted this one again, which is fine, but I'm wondering what nacin's ideas were regarding this. I'd like to see this addressed in the near future, so if there's something I can do to help that happen let me know.

#18 @wonderboymusic
11 years ago

  • Milestone changed from Future Release to 3.7

Patch was failing against trunk, refreshed

#19 @desrosj
11 years ago

  • Cc desrosj@… added

#20 in reply to: ↑ 13 @jeremyfelt
11 years ago

  • Keywords commit 3.6-early removed
  • Milestone changed from 3.7 to Future Release

Replying to nacin:

I have some ideas here. Punting as this can be done by manually adding rules for now.

Punting this to future release as there seems to be some outstanding thoughts on approach.

Note: See TracTickets for help on using tickets.