Title: block_editor_meta_box_hidden_fields
Published: December 6, 2018
Last modified: May 20, 2026

---

# do_action( ‘block_editor_meta_box_hidden_fields’, WP_Post $post )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#wp--skip-link--target)

Adds hidden input fields to the meta box save form.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#description)󠁿

Hook into this action to print `<input type="hidden" ... />` fields, which will 
be POSTed back to the server when meta boxes are saved.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#parameters)󠁿

 `$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)

The post that is being edited.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#source)󠁿

    ```php
    do_action( 'block_editor_meta_box_hidden_fields', $post );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/post.php#L2605)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/post.php#L2605-L2605)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#related)󠁿

| Used by | Description | 
| [the_block_editor_meta_box_post_form_hidden_fields()](https://developer.wordpress.org/reference/functions/the_block_editor_meta_box_post_form_hidden_fields/)`wp-admin/includes/post.php` |

Renders the hidden form required for the meta boxes form.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/?output_format=md#comment-content-2997)
 2.   [Manzoor Wani](https://profiles.wordpress.org/manzoorwanijk/)  [  7 years ago  ](https://developer.wordpress.org/reference/hooks/block_editor_meta_box_hidden_fields/#comment-2997)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_editor_meta_box_hidden_fields%2F%23comment-2997)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_editor_meta_box_hidden_fields%2F%23comment-2997)
 4. In `save_post` hook, to check if the post is published via gutenberg, use this
 5.     ```php
        add_action( 'block_editor_meta_box_hidden_fields', 'add_gutenberg_hidden_fields', 10, 1 );
        function add_gutenberg_hidden_fields( $post ) {
    
        	echo '<input type="hidden" name="your-field" value="some-value">';
        	echo '<input type="hidden" name="is_gutenberg_post" value="1">';
        }
        ```
    
 6. then inside `save_post` callback, use
 7.     ```php
        if ( isset( $_POST['is_gutenberg_post'] ) ) {
            // came from gutengerg
        }
        ```
    
 8.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_editor_meta_box_hidden_fields%2F%3Freplytocom%3D2997%23feedback-editor-2997)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_editor_meta_box_hidden_fields%2F)
before being able to contribute a note or feedback.