Adding Content to the Admin Edit Screen

When creating custom post types, you often need custom fields for them. In the past, your options were “normal” or “side” with priorities. Depending on what else is displayed on your edit screen, these boxes could vary in where they appeared.

And sometimes you just need to add a comment or note to the edit pages.

Good News! We now have new hooks to place them precisely:

add_action( 'edit_form_top', 'myprefix_edit_form_top' );
function myprefix_edit_form_top() {
    echo '<h2>This is edit_form_top!</h2>';
}

add_action( 'edit_form_after_title', 'myprefix_edit_form_after_title' );
function myprefix_edit_form_after_title() {
    echo '<h2>This is edit_form_after_title!</h2>';
}
 
add_action( 'edit_form_after_editor', 'myprefix_edit_form_after_editor' );
function myprefix_edit_form_after_editor() {
    echo '<h2>This is edit_form_after_editor!</h2>';
}
 
add_action( 'edit_form_advanced', 'myprefix_edit_form_advanced' );
function myprefix_edit_form_advanced() {
    echo '<h2>This is ye olde edit_form_advanced!</h2>';
}

Here’s an article that explains the usage: https://make.wordpress.org/core/2012/12/01/more-hooks-on-the-edit-screen/

 

Comments are closed.

Skip to toolbar