Make WordPress Core

Opened 3 years ago

Closed 3 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 3 years ago.
Unit test
23302.patch (645 bytes) - added by johnpbloch 3 years ago.

Download all attachments as: .zip

Change History (10)

3 years ago


3 years ago

Test case

#1 @SergeyBiryukov
3 years ago

  • Component changed from Permalinks to Post Types

3 years ago

Unit test

3 years ago

#2 @johnpbloch
3 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.

#3 @nacin
3 years ago

In 1324/tests:

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

props johnpbloch.
see #23302.

#4 @nacin
3 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.

#5 @marcosf
3 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.

#6 @ocean90
2 years ago

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