edit_page_form
Fires after all meta boxes in the normal position but before those in the advanced position on the post editing screen in the admin area, allowing HTML to be added. Fires only when adding/editing a page (post_type = page). Outputs nothing by default.
Read add_meta_box for information about meta box output locations (positions).
To output a similar block for other post types, use the edit_form_advanced hook.
Usage
add_action( 'edit_page_form', 'wp_kama_edit_page_form_action' );
/**
* Function for `edit_page_form` action-hook.
*
* @param WP_Post $post Post object.
*
* @return void
*/
function wp_kama_edit_page_form_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( 'edit_page_form', 'add_block_edit_page_form' );
function add_block_edit_page_form( $post ) {
?>
<div class="my-box">
<h1>Your content goes here</h1>
</div>
<style>
.my-box h1 {
margin-top: 10px;
padding: 15px;
color: #ffffff;
background: #0085ba;
}
</style>
<?php
}Changelog
| Since 1.5.0 | Introduced. |
Where the hook is called
In file: /wp-admin/edit-form-advanced.php
edit_page_form
wp-admin/edit-form-advanced.php 731
do_action( 'edit_page_form', $post );
Where the hook is used in WordPress
wp-includes/class-wp-embed.php 47
add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) );
