Skip to:
Content
Pages
Categories
Search
Top
Bottom

Error: Are you sure you wanted to do that?


  • artmuns
    Participant

    @artmuns

    Hi,

    I’m getting the “Error: Are you sure you wanted to do that?”. This happens when replying to a topic or creating a topic. It’s also intermittent and no clear pattern when it happens. I have found if I reply again (or try creating the topic again) it will post.

    I have looked online for a solution but the solutions I have found don’t seem to apply. Any suggestions?

    Thanks for any help.

Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W
    Moderator

    @robin-w

    the error is when the ‘nonce’ does not validate.

    https://codex.wordpress.org/WordPress_Nonces

    not sure what you can do about it, not my speciality πŸ™‚


    artmuns
    Participant

    @artmuns

    the error is when the β€˜nonce’ does not validate.

    https://codex.wordpress.org/WordPress_Nonces

    I suppose I could try using translation to make it a friendly message but would rather try and fix it.

    function my_nonce_message ($translation) {
        if ($translation === 'Are you sure you want to do this?') {
           return 'Please try again.';
        } 
    
        return $translation;
    }
     
    add_filter('gettext', 'my_nonce_message');

    Robin W
    Moderator

    @robin-w

    It’s not an error I’ve seen often.

    usually it would relate to url’s being wrong, but this would then apply to all your attempts.


    lmstearn
    Participant

    @lmstearn

    Get this too, mostly on expired pages.
    When first using BBPress, not long ago – roughly the time of the OP, no issue.
    the nonce error started cropping up sometime after the installation of BuddyPress and BBPress, when it happened, you could back out and retrieve the cached text of the post. Regarding the error there is also this solution, would you recommend that?
    since then, providers have changed, no change to the error, the cache has also disappeared, so the post cannot be retrieved.
    Tried ChromeCacheiew to extract anything from the cache, no dice, is there anything one can do, if not addressing the nonce error, retrieve the last/lost cache?
    Thanks


    artmuns
    Participant

    @artmuns

    @Imsteam I’m still getting these occasionally when I reply to a topic. I’ve gotten in the habit of saving my reply in notepad, especially if it’s a long one. Sometimes I can fix it by clearing the cache for that page (I use WP-Rocket). The solution you found looks interesting but it’s for a local install. I wonder what the change would be for a hosted site.


    lmstearn
    Participant

    @lmstearn

    @artmuns: Totally acknowledge the user problem with expired pages causing this over here, and certainly copying the post-text is the first line of defence, just curious as to what it was in the superseded code that cached the text.

    Maybe the following,

    add_filter( 'bbp_verify_nonce_request_url', 'my_bbp_verify_nonce_request_url', 999, 1 );
    function my_bbp_verify_nonce_request_url( $requested_url )
    {
        return 'your_URI' . $_SERVER['REQUEST_URI'];
    }

    Now the functions.php has been dropped from Twenty Twenty Two and onwards, so might not be possible in the theme, could be a separate plugin, or a request for a cache module.

    For caching, use LiteSpeed over here, just added into the ESI Cache section these:

    bbp_verify_nonce_request
    wp_verify_nonce

    Not sure if they are correct, will post back if not. πŸ™‚


    artmuns
    Participant

    @artmuns

    @lmstearn: Thanks for that info on the php code.

    Here’s some info I found previously on this error (but you probably already knew this).

    The ‘Are you sure you want to do this? ‘ error usually appears when nonce verification fails, and the most likely candidates for causing this error are plugins and themes not using this feature properly. Nonces are unique keys that add a security layer to protect WordPress URLs, forms, and Ajax calls from abuse.

    https://www.google.com/search?q=are+you+sure+you+want+to+do+that+error+wordpress

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar