[wp-trac] [WordPress Trac] #31559: Meta boxes should have before/after hooks
WordPress Trac
noreply at wordpress.org
Sat Mar 7 20:38:34 UTC 2015
#31559: Meta boxes should have before/after hooks
----------------------------+-----------------------------
Reporter: jtsternberg | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
Currently there is no way to hook into an existing metabox. If I wanted to
modify the featured image metabox (add a checkbox or something), I'd have
to unregister the metabox, and re-register w/ my own callback. This is not
good for compatibility w/ other plugins, etc.
I propose before_callback and after_callback hooks for metaboxes.
Basically, we'd replace this:
{{{
echo '<div class="inside">' . "\n";
call_user_func($box['callback'], $object, $box);
echo "</div>\n";
}}}
with:
{{{
echo '<div class="inside">' . "\n";
do_action( 'before_metabox_callback', $object, $box );
do_action( "before_{$box['id']}_metabox_callback", $object, $box );
call_user_func($box['callback'], $object, $box);
do_action( 'after_metabox_callback', $object, $box );
do_action( "after_{$box['id']}_metabox_callback", $object, $box );
echo "</div>\n";
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/31559>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list