wp_refresh_metabox_loader_nonces

The timeline below displays how wordpress function wp_refresh_metabox_loader_nonces has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Refresh nonces used with meta boxes in the block editor.
 *
 * @since 6.1.0
 *
 * @param array  $response  The Heartbeat response.
 * @param array  $data      The $_POST data sent.
 * @return array The Heartbeat response.
 */
function wp_refresh_metabox_loader_nonces($response, $data)
{
    if (empty($data['wp-refresh-metabox-loader-nonces'])) {
        return $response;
    }
    $received = $data['wp-refresh-metabox-loader-nonces'];
    $post_id = (int) $received['post_id'];
    if (!$post_id) {
        return $response;
    }
    if (!current_user_can('edit_post', $post_id)) {
        return $response;
    }
    $response['wp-refresh-metabox-loader-nonces'] = array('replace' => array('metabox_loader_nonce' => wp_create_nonce('meta-box-loader'), '_wpnonce' => wp_create_nonce('update-post_' . $post_id)));
    return $response;
}