[wp-trac] [WordPress Trac] #64156: add_post_type_support() does not merge sub-properties for the same feature
WordPress Trac
noreply at wordpress.org
Mon Nov 3 12:54:54 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: 6.9
Component: General | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+---------------------
Comment (by tusharaddweb):
the issue is still there so better to patch in core as under wp-
includes/post.php
replace the add_post_type_support function code with below code so it will
remove the problems
{{{
function add_post_type_support( $post_type, $feature, $args = true ) {
global $_wp_post_type_features;
if ( ! isset( $_wp_post_type_features[ $post_type ] ) ) {
$_wp_post_type_features[ $post_type ] = [];
}
if ( is_array( $feature ) ) {
foreach ( $feature as $f ) {
add_post_type_support( $post_type, $f, $args );
}
return;
}
if ( isset( $_wp_post_type_features[ $post_type ][ $feature ] )
&& is_array( $_wp_post_type_features[ $post_type ][ $feature ] )
&& is_array( $args )
) {
$_wp_post_type_features[ $post_type ][ $feature ] = array_merge(
$_wp_post_type_features[ $post_type ][ $feature ],
$args
);
} else {
$_wp_post_type_features[ $post_type ][ $feature ] = $args;
}
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64156#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list