Make WordPress Core

Opened 2 years ago

Closed 20 months ago

Last modified 19 months ago

#23302 closed defect (bug) (fixed)

Feeds or Feed - add_permastruct missunderstanding.

Reported by: butuzov Owned by: nacin
Milestone: 3.7 Priority: normal
Severity: normal Version: 3.5.1
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:


In case of register_post_type you "can" specify to add feeds to permalink structure or not. You actualy can do that by specifing a 'feeds' element to false in rewrite array.

But add_permastruct doesn't accept feeds element of rewrite argument. Its accept 'feed' element which default is true. So in this case its not posible to disable feeds for any post type via register_post_type API.

Attachments (4)

feeds2feed.patch (640 bytes) - added by butuzov 2 years ago.
feeds.php (1.2 KB) - added by butuzov 2 years ago.
Test case
23302.test.patch (739 bytes) - added by johnpbloch 20 months ago.
Unit test
23302.patch (645 bytes) - added by johnpbloch 20 months ago.

Download all attachments as: .zip

Change History (10)

@butuzov2 years ago


@butuzov2 years ago

Test case

comment:1 @SergeyBiryukov2 years ago

  • Component changed from Permalinks to Post Types

@johnpbloch20 months ago

Unit test

@johnpbloch20 months ago

comment:2 @johnpbloch20 months ago

I updated the original fix to use array merge so that 'feed' doesn't get added to the post type's rewrite array. I also added a patch for the unit test.

comment:3 @nacin20 months ago

In 1324/tests:

Test for passing the correct argument to add_permastruct() when registering a post type.

props johnpbloch.
see #23302.

comment:4 @nacin20 months ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 24830:

When registering a post type, pass the correct argument for feeds to add_permastruct().

props butuzov, johnpbloch.
fixes #23302.

comment:5 @marcosf20 months ago

I've added a patch to remove 1 condition in posts.php that made has_archive overwrite the feed setting in #24867 . I had a brief discussion about this with Nacin today.

comment:6 @ocean9019 months ago

  • Milestone changed from Awaiting Review to 3.7
Note: See TracTickets for help on using tickets.