edit_form_advanced
Action HookDescription
Renders the hidden form required for the meta boxes form.Hook Information
File Location |
wp-admin/includes/post.php
View on GitHub
|
Hook Type | Action |
Line Number | 2560 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Post
|
$post
|
Current post object. function the_block_editor_meta_box_post_form_hidden_fields( $post ) { $form_extra = ''; if ( 'auto-draft' === $post->post_status ) { $form_extra .= ""; } $form_action = 'editpost'; $nonce_action = 'update-post_' . $post->ID; $form_extra .= ""; $referer = wp_get_referer(); $current_user = wp_get_current_user(); $user_id = $current_user->ID; wp_nonce_field( $nonce_action ); /* Some meta boxes hook into these actions to add hidden input fields in the classic post form. For backward compatibility, we can capture the output from these actions, and extract the hidden input fields. |
Usage Examples
Basic Usage
<?php
// Hook into edit_form_advanced
add_action('edit_form_advanced', 'my_custom_function', 10, 1);
function my_custom_function($post) {
// Your custom code here
}
Source Code Context
wp-admin/includes/post.php:2560
- How this hook is used in WordPress core
<?php
2555 */
2556 ob_start();
2557 /** This filter is documented in wp-admin/edit-form-advanced.php */
2558 do_action( 'edit_form_after_title', $post );
2559 /** This filter is documented in wp-admin/edit-form-advanced.php */
2560 do_action( 'edit_form_advanced', $post );
2561 $classic_output = ob_get_clean();
2562
2563 $classic_elements = wp_html_split( $classic_output );
2564 $hidden_inputs = '';
2565 foreach ( $classic_elements as $element ) {
PHP Documentation
<?php
/**
* Renders the hidden form required for the meta boxes form.
*
* @since 5.0.0
*
* @param WP_Post $post Current post object.
*/
function the_block_editor_meta_box_post_form_hidden_fields( $post ) {
$form_extra = '';
if ( 'auto-draft' === $post->post_status ) {
$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
}
$form_action = 'editpost';
$nonce_action = 'update-post_' . $post->ID;
$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr( $post->ID ) . "' />";
$referer = wp_get_referer();
$current_user = wp_get_current_user();
$user_id = $current_user->ID;
wp_nonce_field( $nonce_action );
/*
* Some meta boxes hook into these actions to add hidden input fields in the classic post form.
* For backward compatibility, we can capture the output from these actions,
* and extract the hidden input fields.
*/
Quick Info
- Hook Type: Action
- Parameters: 1
- File: wp-admin/includes/post.php
Related Hooks
Related hooks will be displayed here in future updates.