# the_block_editor_meta_box_post_form_hidden_fields()

URL: https://chugunov.pro/api-wordpress/functions/the_block_editor_meta_box_post_form_hidden_fields/
Проверено на WordPress 6.9, обновлено 06.08.2026.
Источник: независимый русскоязычный справочник chugunov.pro. Не является официальной документацией WordPress.

Тип: функция.
Появился в версии: 5.0.0.

## Сигнатура

```php
the_block_editor_meta_box_post_form_hidden_fields( WP_Post $post )
```

## Описание

Отображает скрытую форму, необходимую для формы метабоксов.

## Параметры

- `$post` `WP_Post` — обязательный. Текущий объект записи.

## Исходный код

Файл: `wp-admin/includes/post.php:2541`

```php
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.
	 */
	ob_start();
	/** This filter is documented in wp-admin/edit-form-advanced.php */
	do_action( 'edit_form_after_title', $post );
	/** This filter is documented in wp-admin/edit-form-advanced.php */
	do_action( 'edit_form_advanced', $post );
	$classic_output = ob_get_clean();

	$classic_elements = wp_html_split( $classic_output );

	foreach ( $classic_elements as $element ) {
		if ( ! str_starts_with( $element, '<input ' ) ) {
			continue;
		}

		if ( preg_match( '/\stype=[\'"]hidden[\'"]\s/', $element ) ) {
			echo $element;
		}
	}
	?>
	<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_id; ?>" />
	<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ); ?>" />
	<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ); ?>" />
	<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post->post_type ); ?>" />
	<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status ); ?>" />
	<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />

	<?php
	if ( 'draft' !== get_post_status( $post ) ) {
		wp_original_referer_field( true, 'previous' );
	}
	echo $form_extra;
	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
	// Permalink title nonce.
	wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );

	/**
	 * Adds hidden input fields to the meta box save form.
	 *
	 * Hook into this action to print `<input type="hidden" ... />` fields, which will be POSTed back to
	 * the server when meta boxes are saved.
	 *
	 * @since 5.0.0
	 *
	 * @param WP_Post $post The post that is being edited.
	 */
	do_action( 'block_editor_meta_box_hidden_fields', $post );
}
```

## История изменений

- 5.0.0 — Introduced.

## Связанные

Использует: [`wp_html_split`](https://chugunov.pro/api-wordpress/functions/wp_html_split/), [`wp_get_current_user`](https://chugunov.pro/api-wordpress/functions/wp_get_current_user/), [`wp_get_referer`](https://chugunov.pro/api-wordpress/functions/wp_get_referer/), [`wp_nonce_field`](https://chugunov.pro/api-wordpress/functions/wp_nonce_field/), [`wp_original_referer_field`](https://chugunov.pro/api-wordpress/functions/wp_original_referer_field/), [`get_post_status`](https://chugunov.pro/api-wordpress/functions/get_post_status/), [`esc_attr`](https://chugunov.pro/api-wordpress/functions/esc_attr/), [`esc_url`](https://chugunov.pro/api-wordpress/functions/esc_url/), [`do_action`](https://chugunov.pro/api-wordpress/functions/do_action/).
Используется в: [`the_block_editor_meta_boxes`](https://chugunov.pro/api-wordpress/functions/the_block_editor_meta_boxes/).

Оригинал в официальной документации: https://developer.wordpress.org/reference/functions/the_block_editor_meta_box_post_form_hidden_fields/
