Search code examples
phpwordpresspluginswpmlgravityforms

WordPress Error "A variable mismatch has been detected."


I am receiving this WordPress error when I am trying to delete a gravity-form-coupon feed:

A variable mismatch has been detected.

Note: I am creating the feeds dynamically (PHP).

I tried to debug it with all the debugging plugins and enabled all the debug flags but I can't see why and what is causing this?

Can someone please explain why might be the cause and why this error triggers?


Solution

  • Phew...

    WordPress shows this error on

    elseif ( isset( $_GET[ $wpvar ] ) && isset( $_POST[ $wpvar ] ) && $_GET[ $wpvar ] !== $_POST[ $wpvar ] ) {
                    wp_die( __( 'A variable mismatch has been detected.' ), __( 'Sorry, you are not allowed to view this item.' ), 400 );
                }
    

    https://github.com/WordPress/WordPress/blob/abcbee954f4d8baa5aff2df566a942c1b48ca2d7/wp-includes/class-wp.php

    which means if any element is present in both arrays($_POST/$_GET) the value should be the same.

    in my case the $_GET['page'] was not equals to $_POST['page'] which triggered this error.