Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [nonce]

The tag has no usage guidance.

0
votes
2answers
31 views

Serving nonces through AJAX is not refreshing nonce, returning 403 error

I have run into an issue with nonces becoming invalid, and being unable to refresh to a new nonce. In my example I have a Facebook Connect button, and a Facebook Disconnect button, each with their own ...
1
vote
1answer
52 views

“The link you followed has expired” when previewing a post

Recently, I believe after switching to WP 5, non admin users are randomly getting the following error when previewing a post: “The link you followed has expired” . Please try again I am suspecting ...
1
vote
1answer
533 views

wp_create_nonce() in REST API makes user->ID zero

I have trouble with wp_create_nonce() and wp_verify_nonce(). The root of my problem is both the way nonces are created and the place where I generate nonces. Looking at the codes of wp_create_nonce()...
1
vote
1answer
383 views

Can you have more than one nonce on a page?

I have a site with a page where there's one form in the sidebar, and one in the main body of the page. The sidebar comes first in the HTML. Both forms have their own nonces (generated with ...
1
vote
1answer
634 views

Why does Wordpress Heartbeat login not refresh the nonces?

Here's an interesting experiment: Go to wordpress plugins listing page, notice the activate, deactivate links all have a nonce part in the request. In a second tab, log out of the site, and go back ...
0
votes
1answer
17 views

How to check nonce lifetime value of plugins?

Dear StackExchange users, I currently use the premium version of WP Fastest Cache Premium. My website loads very fast, but I always get a 403 error for wp-admin/ajax. I believe there is a plugin ...
0
votes
1answer
59 views

Override plugin function to show invoices even if not logged in

I am using WooCommerce Print Invoice plugin to print invoices. Now I am working on a Cordova app for my website and I need to be able to see invoices from wordpress. Plugin has a function to hide or ...
0
votes
1answer
155 views

Rest API invalid nonce with Backbone Client

I'm using the built-in Backbone Client whenever I try to make a request it gives me this error: {"code":"rest_cookie_invalid_nonce","message":"Cookie nonce is invalid","data":{"status":403}} I read ...
0
votes
1answer
228 views

Register rest field authentication with REST API

I'm trying to add some user meta information to the existing wp/v2/users REST endpoint. However, it looks like additional authentication is required, i.e. I get this (output in comments): ...
0
votes
1answer
667 views

Maximum lifetime for nonce

In our project we allow users to buy a coupon ( WooCommerce product ) for some service. We save every coupon as a custom post type with all the customer data inserted during purchase. We then via ...
0
votes
1answer
127 views

Nonce and widget

I've been screening the code of several widget and haven't found any one of them handling nonce. I also took a look at the WP_Widget class and found nothing about it as well. This is from the codex: (...
0
votes
1answer
241 views

Nonce fail after second submit attempt

I am refactoring my plugin that resets the WordPress database tables back to their defaults and came across an issue. The form submission itself works fine. However, after the first submit, and if ...
0
votes
1answer
380 views

custom metabox nonce verification fails

I'm adding a metabox on a custom post type and my nonce-verification fails. I'm not really where to look for why it's going wrong. Can anyone point me in the right direction? Here's my code: function ...
0
votes
1answer
305 views

Using Nonce for my Form

Essentially I need to verify my data using a nonce, but I'm not sure that I'm doing it right. What I'm trying to do is remove a menu option for a user that isn't an admin. If a checkbox is checked and ...
3
votes
0answers
176 views

WordPress REST API call generates nonce twice on every call

I'm trying to login a user via the REST API, and then retrieve the current user on subsequent requests. As per the documentation, in my plugin, I am creating and retrieving a nonce after a successful ...
3
votes
0answers
398 views

WordPress “Link has expired” error on updating posts

I'm maintaining a WordPress site on GoDaddy for a client and they started to get the "this link has expired error" when they saved a post. It does not happen when I upload a file. However, I am ...
1
vote
0answers
13 views

Why ajax doesn't work on certain wordpress hooks and reload the page instead?

I built an ajax function which works perfectly when i hook it to admin_head or admin_notices hooks but it doesn't work when i hook it to manage_posts_extra_tablenav hook, instead of doing the ajax ...
1
vote
0answers
16 views

Why ajax doesn't work on certain wordpress hooks?

I built an ajax function which works perfectly when i hook it to admin_head or admin_notices hooks but it doesn't work when i hook it to manage_posts_extra_tablenav hook, instead of doing the ajax ...
1
vote
0answers
47 views

Wordpress password reset - why post rp_key?

I'm developing a plugin and after reading through wp-login.php, I can't seem to work out why some things are done the way they are. Why does WordPress hide the reset password key from the URL? After ...
1
vote
0answers
293 views

Full page NGINX (or Cloudflare) caching and WordPress nonces

Goal: I want to cache the full WordPress response via NGINX and exclusively use the REST API for the user specific parts. Issue: I can't get an authenticated nonce to use against the API. My plan ...
1
vote
0answers
276 views

Encountering “Wrong nonce. Action prohibitied.” when trying to alter User Role and unable to Post via WP Admin

The plugin in question that I believe is displaying this message is the User Role Editor, although I do not believe it is causing the issue as users who should have permissions to make posts on the ...
1
vote
0answers
47 views

Is there value in using a wp_nonce for POST requests?

All of the examples I see using wp_create_nonce are in the context of a GET request. You embed a nonce in URLs to ensure malicious links or scripts can't trick a user into, say, deleting a post. ...
1
vote
0answers
40 views

Nonce fails on ajax save

I have made options page with 2 forms and two separate nonce fields, and other input fields that I save with AJAX. The issue is that every time I save and call my function to save options via AJAX I ...
1
vote
0answers
409 views

Bypass nonce value while trashing a post

I want to move a post in trash but the condition is that simultaneously I need to delete some more posts. Sample Code: jQuery(function($) { $('#delete-action a').unbind(); $('#delete-action a'...
1
vote
0answers
103 views

My custom write panels won't save data. What am I missing?

So far I've been reading some tutorials about ways to create Custom Write Panels. It seems that none of them will really work without some bug. I'd like to discuss one of those tuts here: http://www....
0
votes
0answers
26 views

wp_nonce_url generating invalid links

My goal is to allow users to delete posts they own from the front end. I have an API that returns some JSON along with a link to delete their post. $delLink = wp_nonce_url( site_url() . "/wp-admin/...
0
votes
0answers
17 views

Undefined Index: post_type error on Adding New Page due to nonce

It apparently seem like a duplicate question (Undefined 'post_type' error on Add new page), I've tried solving since a last few hours along with researching and now it's time to ask from ...
0
votes
0answers
42 views

How can I verify WordPress nonce from the following code?

<?php /** * Template Name: Manage Days */ if ( isset($_GET['remove_date']) && isset($_GET['_wpnonce']) ) { $delete_date = $_GET['remove_date']; $delete_nonce = $_GET['_wpnonce']; ...
0
votes
0answers
679 views

AJAX form not working, still reloads on submit

I've built a like and unlike system for users, and it works amazingly. The only problem is the page reloads, therefore, I've tried to set up AJAX to submit the form without a page refresh. However, it'...
0
votes
0answers
33 views

Passing nonce at admin menu link

I'm trying to pass a nonce at the links created from my plugin using add_menu_page and add_submenu_page. Of course this is invalid: add_submenu_page( 'my_dashboard', 'Dashboard', 'Dashboard', '...
0
votes
0answers
282 views

Are nonces in WP REST API optional by default?

I'm switching my code from using wp-ajax to the REST API and got puzzled regarding the nonces. First of all, I find it weird that you have to use wp_rest only, since API has many different methods and ...
0
votes
0answers
192 views

Set nonces correctly for a JSON REST API v2 (WP 4.8.5)

I'm using Gravity Forms, and I want to use a jQuery script to set some defaults in my form. Whenever the user dropdown changes, fetch all the roles belonging to the chosen user. I thought the simplest ...
0
votes
0answers
243 views

CSRF attack to create USER

I'm looking for to fix the issue below : The following scenario show a successful CSRF attack resulting in the creation of a new user on wordpress: The attacker sends malicious html page to an ...
0
votes
0answers
802 views

wp_verify_nonce fails always

I have created nonce fro my plugin and trying to verify it with another plugin pages. it fails always. both we are creating nonce with same parameter. why it fails. Plugin name : Wordfence it creates ...
0
votes
0answers
765 views

How to use nonces for frontend AJAX voting if the page gets cached?

I'm building a custom voting solution for my site that would allow public AJAX voting on multiple posts per page. Votes can be added/changed/revoked. Values are stored in custom post meta. I ...
0
votes
0answers
509 views

Create nonce in frontend page to edit profile

I am trying to create a frontend edit profile form that mimics the wp-admin backend edit profile. I created the form as HTML directly in a WordPress page (I'm a PHP/WordPress beginner, so I don't know ...
0
votes
0answers
211 views

when saveing $meta_box i get Undefined index error

I need help to fix these Notices: PHP Notice: Undefined index: person-name in testimonials.php on line 112 PHP Notice: Undefined index: position in testimonials.php on line 112 PHP Notice: Undefined ...