#21527 closed enhancement (fixed)
post_type_supports(), no arguments case
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
At line 1388 in wp-includes/post.php when checking for number of arguments passed to post_type_supports():
if( function_num_args() <= 2 )
return true;
Obviously it does not hurt, but absolutely it's just an extra code.
Attachments (2)
Change History (12)
#4
@
13 years ago
- Keywords has-patch added
- Resolution invalid deleted
- Status changed from closed to reopened
#7
follow-up:
↓ 8
@
12 years ago
Looks like remove_post_type_support()
can lose some redundant code too, the second isset()
check is unnecessary: 21527.2.diff.
#8
in reply to:
↑ 7
;
follow-up:
↓ 10
@
12 years ago
I know returning early is a popular coding convention in core, but why not just say:
<?php if ( isset( $_wp_post_type_features[$post_type] ) ) unset( $_wp_post_type_features[$post_type][$feature] );
Note: See
TracTickets for help on using
tickets.
Looking at the code (introduced in [12682]), seems that the check can be removed indeed:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/post.php#L1358
Related: #17584