Update theme nonce handling

This commit is contained in:
Tetrakern 2023-10-27 17:53:17 +02:00
parent 6760b6e1e8
commit 7301ee4484
3 changed files with 3 additions and 8 deletions

View File

@ -63,7 +63,7 @@ do_action( 'fictioneer_after_main', $args );
?>
<?php /* Adding the AJAX nonce this way allows caching plugins to update it dynamically. */ ?>
<input id="fictioneer-nonce" name="fictioneer_nonce" type="hidden" value="<?php echo wp_create_nonce( 'fictioneer_nonce' ); ?>">
<input name="fictioneer_nonce" type="hidden" value="<?php echo wp_create_nonce( 'fictioneer_nonce' ); ?>">
<?php
// Lightbox container

2
js/utility.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -644,11 +644,6 @@ function fcn_isValidUrl(url) {
// GET NONCE
// =============================================================================
// This nonce is always included in the template file but may not be correct
// if caching is active. Some caching plugins can localize nonces if you add
// them to a special list. Otherwise enable AJAX user authentication.
var fcn_defaultNonce = _$$$('fictioneer-nonce')?.value ?? 0;
/**
* Return the Fictioneer nonce, accounting for dynamic nonces.
*
@ -657,7 +652,7 @@ var fcn_defaultNonce = _$$$('fictioneer-nonce')?.value ?? 0;
*/
function fcn_getNonce() {
return _$$$('fictioneer-ajax-nonce')?.value ?? fcn_defaultNonce;
return _$$$('fictioneer-ajax-nonce')?.value ?? _$('[name="fictioneer_nonce"]')?.value ?? 0;
}
// =============================================================================