[wp-trac] [WordPress Trac] #64156: add_post_type_support() does not merge sub-properties for the same feature

WordPress Trac noreply at wordpress.org
Wed Oct 29 00:56:53 UTC 2025


#64156: add_post_type_support() does not merge sub-properties for the same feature
--------------------------------------+------------------------------
 Reporter:  fabiankaegy               |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  General                   |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+------------------------------

Comment (by joemcgill):

 @fabiankaegy asked for my opinion on this issue, and I think it would be
 totally fine to enhance the current implementation of
 `add_post_type_support()` so that multiple calls for the same post type
 and feature with different args would merge the args rather than overwrite
 them.

 However, I think before doing so, we should consider whether overloading
 the args of the editor feature like this is the best choice.

 It's important to remember that `add_post_type_support()` and the related
 subsystem was originally added in #9674 in order to help signal which
 features should be supported in the editor for custom post types. Quoting
 [https://developer.wordpress.org/reference/functions/add_post_type_support/
 the dev resources site] for this function:

 > All core features are directly associated with a functional area of the
 edit screen, such as the editor or a meta box. Features include: ‘title’,
 ‘editor’, ‘comments’, ‘revisions’, ‘trackbacks’, ‘author’, ‘excerpt’,
 ‘page-attributes’, ‘thumbnail’, ‘custom-fields’, and ‘post-formats’.

 Rather than adding more args to the `editor` feature, it's probably better
 to introduce new features to this system, like:

 {{{#!php
 add_theme_support( 'page', 'block-comments' );
 }}}

 Rather than overloading the args, like:

 {{{#!php
 add_post_type_support( 'page', 'editor', array(
     'block-comments' => true,
 ) );
 }}}

 Juggling several unrelated sets of args for the same feature seems like it
 will be more fragile and lead to more conflicts between plugins and themes
 trying to customize unrelated args for a single feature.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64156#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list