Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years 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 3 years ago.
feeds.php (1.2 KB) - added by butuzov 3 years ago.
Test case
23302.test.patch (739 bytes) - added by johnpbloch 2 years ago.
Unit test
23302.patch (645 bytes) - added by johnpbloch 2 years ago.

Download all attachments as: .zip

Change History (10)

@butuzov3 years ago


@butuzov3 years ago

Test case

comment:1 @SergeyBiryukov3 years ago

  • Component changed from Permalinks to Post Types

@johnpbloch2 years ago

Unit test

@johnpbloch2 years ago

comment:2 @johnpbloch2 years 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 @nacin2 years ago

In 1324/tests:

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

props johnpbloch.
see #23302.

comment:4 @nacin2 years 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 @marcosf2 years 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 @ocean902 years ago

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