dbx_post_sidebar
Fires after all meta boxes (before the closing div#post-body tag) on the post editing screen in the admin area, allowing HTML to be added. Outputs nothing by default.
Fires after the edit_page_form and edit_form_advanced hooks. Usage examples are very similar. The hooks fire in the following order:
...
if ( 'page' == $post_type ) {
// Fires only on pages
do_action( 'edit_page_form', $post );
}
else {
// Fires on all other post types
do_action( 'edit_form_advanced', $post );
}
// Output meta boxes attached to the 'advanced' position
do_meta_boxes(null, 'advanced', $post);
?>
</div>
<?php
// The hook described in this article
do_action( 'dbx_post_sidebar', $post );
?>
</div><!-- / #post-body -->
...
Usage
add_action( 'dbx_post_sidebar', 'wp_kama_dbx_post_sidebar_action' );
/**
* Function for `dbx_post_sidebar` action-hook.
*
* @param WP_Post $post Post object.
*
* @return void
*/
function wp_kama_dbx_post_sidebar_action( $post ){
// action...
}
- $post(WP_Post)
- The post object. See get_post() for the object structure.
Examples
#1 Add a custom block
<?php
add_action( 'dbx_post_sidebar', 'add_block_dbx_post_sidebar' );
function add_block_dbx_post_sidebar( $post ) {
?>
<div class="my-box">
<h1>Your content goes here</h1>
</div>
<?php
}Changelog
| Since 2.1.0 | Introduced. |
Where the hook is called
In file: /wp-admin/edit-form-advanced.php
dbx_post_sidebar
wp-admin/edit-form-advanced.php 756
do_action( 'dbx_post_sidebar', $post );
