WordPress Error “A variable mismatch has been detected.”

WordPress Error “A variable mismatch has been detected.”

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.

Feel Free To Message Us