The edit_form_advanced WordPress action fires after the ‘normal’ context meta boxes have been output for all post types other than ‘page’.
Usage
add_action('edit_form_advanced', 'your_custom_function');
function your_custom_function($post) {
// your custom code here
}
Parameters
- $post (WP_Post): The post object.
More information
See WordPress Developer Resources: edit_form_advanced
Examples
Add a custom meta box below the content editor
This example adds a custom meta box below the content editor on the post edit screen.
add_action('edit_form_advanced', 'add_custom_meta_box');
function add_custom_meta_box($post) {
add_meta_box('custom_meta_box_id', 'Custom Meta Box Title', 'custom_meta_box_callback', null, 'normal');
}
function custom_meta_box_callback($post) {
// Display custom meta box content
echo 'This is your custom meta box content.';
}
Display post ID
This example displays the post ID below the content editor.
add_action('edit_form_advanced', 'display_post_id');
function display_post_id($post) {
echo '<div><strong>Post ID:</strong> ' . $post->ID . '</div>';
}
Display a notice below the content editor
This example displays a custom notice below the content editor.
add_action('edit_form_advanced', 'display_custom_notice');
function display_custom_notice($post) {
echo '<div class="notice notice-info"><p>Important: Please double-check your post before publishing.</p></div>';
}
Display post creation and modification dates
This example displays the post creation and modification dates below the content editor.
add_action('edit_form_advanced', 'display_post_dates');
function display_post_dates($post) {
$created_date = date('F j, Y, g:i a', strtotime($post->post_date));
$modified_date = date('F j, Y, g:i a', strtotime($post->post_modified));
echo '<div><strong>Created:</strong> ' . $created_date . '</div>';
echo '<div><strong>Last Modified:</strong> ' . $modified_date . '</div>';
}
Add a custom button below the content editor
This example adds a custom button below the content editor.
add_action('edit_form_advanced', 'add_custom_button');
function add_custom_button($post) {
echo '<button type="button" class="button button-primary">Custom Button</button>';
}