Fix general nonce not always being used

Going just by the name attribute can result in the wrong one being queried if there are more than one on the page.
This commit is contained in:
Tetrakern 2024-03-29 15:42:41 +01:00
parent fd57ea0e3d
commit b552d7a6ae
4 changed files with 6 additions and 4 deletions

View File

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

2
js/complete.min.js vendored

File diff suppressed because one or more lines are too long

2
js/utility.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -667,7 +667,9 @@ function fcn_isValidUrl(url) {
*/
function fcn_getNonce() {
return _$$$('fictioneer-ajax-nonce')?.value ?? _$('[name="fictioneer_nonce"]')?.value ?? 0;
return _$$$('fictioneer-ajax-nonce')?.value ??
_$$$('general-fictioneer-nonce')?.value ??
_$('[name="fictioneer_nonce"]')?.value ?? 0;
}
// =============================================================================