[wp-trac] [WordPress Trac] #15000: add_meta_box() should accept array of post types
WordPress Trac
noreply at wordpress.org
Fri Jun 13 01:18:25 UTC 2014
#15000: add_meta_box() should accept array of post types
----------------------------------------+------------------------------
Reporter: coffee2code | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.0.1
Severity: minor | Resolution:
Keywords: good-first-bug needs-patch | Focuses:
----------------------------------------+------------------------------
Changes (by SergeyBiryukov):
* milestone: => Awaiting Review
Comment:
A workaround from comment:7:ticket:13305 that does not require a foreach
loop:
{{{
function your_callback( $post_type ) {
if ( in_array( $post_type, array( 'post', 'page' ) ) ) {
add_meta_box( 'your-id', 'Title', 'your_box_callback',
$post_type );
}
}
add_action( 'add_meta_boxes', 'your_callback', 10, 2 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/15000#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list