Block Editor: Use a unique name for the nonce of the custom fields toggle form.

Avoids a browser warning for having two elements with a non-unique id `#_wpnonce` on the post edit screen.

See #23165.
Fixes #51483.
Props vandestouwe, Mista-Flo.

git-svn-id: https://develop.svn.wordpress.org/trunk@50255 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2021-02-08 21:37:34 +00:00
parent fb37bfa8e1
commit df0c776d1f
2 changed files with 2 additions and 2 deletions

View File

@@ -2303,7 +2303,7 @@ function the_block_editor_meta_boxes() {
<?php the_block_editor_meta_box_post_form_hidden_fields( $post ); ?>
</form>
<form id="toggle-custom-fields-form" method="post" action="<?php echo esc_attr( admin_url( 'post.php' ) ); ?>">
<?php wp_nonce_field( 'toggle-custom-fields' ); ?>
<?php wp_nonce_field( 'toggle-custom-fields', 'toggle-custom-fields-nonce' ); ?>
<input type="hidden" name="action" value="toggle-custom-fields" />
</form>
<?php foreach ( $locations as $location ) : ?>

View File

@@ -339,7 +339,7 @@ switch ( $action ) {
exit;
case 'toggle-custom-fields':
check_admin_referer( 'toggle-custom-fields' );
check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
$current_user_id = get_current_user_id();
if ( $current_user_id ) {