Make WordPress Core

Opened 11 years ago

Last modified 5 years ago

#24867 assigned defect (bug)

Feeds for custom posts type can not be set independently of has_archive and supports => comments

Reported by: marcosf's profile marcosf Owned by: nacin's profile nacin
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Posts, Post Types Keywords: needs-patch
Focuses: Cc:

Description (last modified by ocean90)

I was testing the patch for ticket (Feeds or Feed - add_permastruct missunderstanding: #23302) and discovered a few things (I'm using trunk rev 19712).

Turning of feeds for custom post types only works if supports feeds & has_archive are set to either false or true.

If you, e.g. set the argument feeds in rewrite to true and has_archive to false then the rewrite rules for feeds do not get created (some happens of you switch true & false around in both arguments).

This happens due to this condition in /wp-includes/post.php, line 1242:

 if ( ! isset( $args->rewrite['feeds'] ) OR ! $args->has_archive )
  $args->rewrite['feeds'] = (bool) $args->has_archive;

Another problem I run into is that:
With the patch for ticket (#23302) you can not enable/disable the comments feed independent of the main feed of the custom post type. It also does not get disabled if you do not enabled comments via supports. Rewrite rules for feeds seem to always get created.

I've attached an example to showcase what I wrote above.

Attachments (2)

feeds.php (1.2 KB) - added by marcosf 11 years ago.
Test to turn of feeds
24867.diff (1.1 KB) - added by marcosf 11 years ago.

Download all attachments as: .zip

Change History (10)

@marcosf
11 years ago

Test to turn of feeds

@marcosf
11 years ago

#1 @marcosf
11 years ago

  • Cc marcosf added

#2 @marcosf
11 years ago

  • Keywords has-patch added

#3 @nacin
11 years ago

  • Milestone changed from Awaiting Review to 3.7
  • Owner set to nacin
  • Status changed from new to assigned

I talked through this patch with marcosf at the WCSF contributor day. Needs testing, but looks proper. Probably also needs a DB version bump to flush rewrite rules.

#4 @ocean90
11 years ago

  • Description modified (diff)

#5 @nacin
11 years ago

  • Milestone changed from 3.7 to 3.8

This is unfortunately a bit more complicated, see #16415.

#6 @nacin
11 years ago

  • Milestone changed from 3.8 to Future Release

#7 @chriscct7
9 years ago

  • Keywords needs-patch added; has-patch removed

#8 @AJClarke
8 years ago

If anyone is looking for a "temp" fix to at least remove the 404 errors caused by the broken comments feed link I put a little plugin on Github here - https://github.com/wpexplorer/wpex-post-types-feed-links-fix

Note: See TracTickets for help on using tickets.