submitpost_box
Fires before the meta boxes in the sidebar (side position) when editing posts and other post types except pages, allowing the displayed content to be changed.
Read add_meta_box for information about meta box output locations (positions).
To add content for pages, use the submitpage_box hook.
Usage
add_action( 'submitpost_box', 'wp_kama_submitpost_box_action' );
/**
* Function for `submitpost_box` action-hook.
*
* @param WP_Post $post Post object.
*
* @return void
*/
function wp_kama_submitpost_box_action( $post ){
// action...
}
- $post(WP_Post)
- The post object. See get_post() for the object structure.
Examples
#1 Add a block containing a quote
<?php
add_action( 'submitpost_box', 'add_blockquote_submitpage_box' );
function add_blockquote_submitpage_box( $post ) {
?>
<div class="block-blockquote">
<blockquote>
❝
The art of good writing consists in feeling well, thinking well, and expressing well.
❞
</blockquote>
<i>Jean Duclos</i>
</div>
<style>
.block-blockquote {
margin-bottom: 10px;
padding: 15px;
background: #fff
}
.block-blockquote blockquote {
margin: 0;
}
.block-blockquote i {
display: block;
margin-top: 5px;
text-align: right;
}
</style>
<?php
}
Changelog
| Since 2.5.0 | Introduced. |
Where the hook is called
In file: /wp-admin/edit-form-advanced.php
submitpost_box
wp-admin/edit-form-advanced.php 710
do_action( 'submitpost_box', $post );

