Make WordPress Core

Opened 2 years ago

Last modified 4 months ago

#40413 reviewing enhancement

Handle `register_post_type` support's array

Reported by: MaximeCulea Owned by: swissspidy
Milestone: 5.3 Priority: normal
Severity: normal Version: 2.9
Component: Posts, Post Types Keywords: has-patch has-unit-tests
Focuses: Cc:


When registering a post_type's support with the add_post_type_support() function, it's possible to pass "extra" args to the support, because of the func_num_args which will check if there is a third arg.

While when using register_post_type(), you can't pass any extra args to a support, because it will be stripped by how WP_Post_Type->add_supports works.

Attachments (2)

ticket-40413.patch (1.1 KB) - added by MaximeCulea 2 years ago.
Patch 40413-1
ticket-40413.2.patch (2.0 KB) - added by seuser 23 months ago.

Download all attachments as: .zip

Change History (10)

2 years ago

Patch 40413-1

#1 @MaximeCulea
2 years ago

  • Keywords has-patch added

So, as I think this behaviour of giving to a support some more extra features is cool, I submit a patch in this direction.
Now from register_post_type you could register a support with extra args as following :
<?php register_post_type( 'post_type', [ 'supports' => [ 'support' => [ extra_1, extra_2 ] ] ] );

#2 @swissspidy
2 years ago

  • Keywords needs-unit-tests added
  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 2.9

#3 @seuser
23 months ago

  • Keywords has-unit-tests added; needs-unit-tests removed

First shot at something in the Trac so go easy on me :) I've added a test which fails without your patch and now passes with it.

#4 @MaximeCulea
20 months ago

Hi there !
@swissspidy ready to merge ?

#5 @swissspidy
20 months ago

  • Milestone changed from Awaiting Review to 5.0
  • Owner set to swissspidy
  • Status changed from new to reviewing

#6 @johnbillion
9 months ago

  • Milestone changed from 5.0 to 5.1

#7 @pento
6 months ago

  • Milestone changed from 5.1 to 5.2

This needs reviewing and a decision.

#8 @desrosj
4 months ago

  • Milestone changed from 5.2 to 5.3

This ticket has not received any attention during the 5.2 cycle. With beta 1 tomorrow, going to punt this to 5.3.

Note: See TracTickets for help on using tickets.