#13305 closed enhancement (wontfix)
Allow multiple post types to use same add_meta_box call (Pass an array for the $page arg)
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
The $page parameter of add_meta_box http://codex.wordpress.org/Function_Reference/add_meta_box currently only accepts a string to "The type of Write screen on which to show the edit screen section ('post', 'page', or 'link')".
In discussing best way to allow for multiple post types to use the same meta box with 3.0 (beta), scribu indicated that currently one would have to call add_meta_box twice.
scibu: come to think of it, you should be able to pass an array for the $page arg
Change History (9)
#7
@
13 years ago
- Resolution set to wontfix
- Status changed from new to closed
Just leverage the variables passed to the do_meta_boxes callback.
function your_callback( $page, $context ) { if ( in_array( $page, array( 'post', 'page' ) ) && 'normal' == $context ) add_meta_box( 'your-id', 'Title', 'your_box_callback', $page, $context, 'high' ); } add_action( 'do_meta_boxes', 'your_callback', 10, 2 );
This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.
9 years ago
Note: See
TracTickets for help on using
tickets.
Should be simple enough to check if $page is an array, and if so, call add_meta_box again with the same parameters otherwise.
Related: #13937