wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
wp_refresh_metabox_loader_nonces › WordPress Function
Depuis6.1.0
Dépréciéen/a
› wp_refresh_metabox_loader_nonces ( $response, $data )
| Paramètres: (2) |
|
| Retourne: |
|
| Défini(e) dans: |
|
| Codex: |
Refresh nonces used with meta boxes in the block editor.
Fonctions en relation: wp_refresh_heartbeat_nonces, wp_refresh_post_nonces, wp_refresh_post_lock, wp_ajax_meta_box_order, wp_ajax_meta_box_reordering
Source
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;
}