Ticket #14077: 14077.4.diff
File 14077.4.diff, 2.3 KB (added by , 11 years ago) |
---|
-
wp-includes/post.php
1306 1306 * and the 'comments' feature dictates whether the comments count will show on the edit screen. 1307 1307 * 1308 1308 * @since 3.0.0 1309 * @param string $post_type The post type for which to add the feature 1310 * @param string|array $feature the feature being added, can be an array of feature strings or a single string1309 * @param string $post_type The post type for which to add the feature. 1310 * @param string|array $features The features being added, can be an array of feature strings or a single string. 1311 1311 */ 1312 function add_post_type_support( $post_type, $feature ) {1312 function add_post_type_support( $post_type, $features ) { 1313 1313 global $_wp_post_type_features; 1314 1314 1315 $features = (array) $feature; 1316 foreach ($features as $feature) { 1315 foreach ( (array) $features as $feature ) { 1317 1316 if ( func_num_args() == 2 ) 1318 $_wp_post_type_features[ $post_type][$feature] = true;1317 $_wp_post_type_features[ $post_type ][ $feature ] = true; 1319 1318 else 1320 $_wp_post_type_features[ $post_type][$feature] = array_slice( func_get_args(), 2 );1319 $_wp_post_type_features[ $post_type ][ $feature ] = array_slice( func_get_args(), 2 ); 1321 1320 } 1322 1321 } 1323 1322 … … 1325 1324 * Remove support for a feature from a post type. 1326 1325 * 1327 1326 * @since 3.0.0 1328 * @param string $post_type The post type for which to remove the feature 1329 * @param string $feature The feature being removed1327 * @param string $post_type The post type for which to remove the feature. 1328 * @param string|array $features The features being removed. Can be an array of feature strings or a single string. 1330 1329 */ 1331 function remove_post_type_support( $post_type, $feature ) {1330 function remove_post_type_support( $post_type, $features ) { 1332 1331 global $_wp_post_type_features; 1333 1332 1334 if ( ! isset($_wp_post_type_features[$post_type]) )1333 if ( ! isset( $_wp_post_type_features[ $post_type ] ) ) 1335 1334 return; 1336 1335 1337 if ( isset($_wp_post_type_features[$post_type][$feature]) ) 1338 unset($_wp_post_type_features[$post_type][$feature]); 1336 foreach ( (array) $features as $feature ) { 1337 if ( isset( $_wp_post_type_features[ $post_type ][ $feature ] ) ) 1338 unset( $_wp_post_type_features[ $post_type ][ $feature ] ); 1339 } 1339 1340 } 1340 1341 1341 1342 /**