| @@ -25,9 +25,12 @@ | ||
| 25 | 25 | return true; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $check_against = [ $_SERVER['REQUEST_URI'] ]; |
| 29 | - if ( isset( $_SERVER['HTTP_REFERER'] ) ) { | |
| 29 | + // This code is designed to handle ajax requests on pages that are excluded. | |
| 30 | + // For ajax requests, the referer is set to the page URL and they use a POST method. | |
| 31 | + // If an ajax request uses a GET method, it can be managed using the available exclusion rules. | |
| 32 | + if ( isset( $_SERVER['HTTP_REFERER'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) { | |
| 30 | 33 | $check_against[] = $_SERVER['HTTP_REFERER']; |
| 31 | 34 | } |
| 32 | 35 | foreach ( $check_against as $check ) { |
| 33 | 36 | foreach ( $match_flags as $rule_flag => $status ) { |
| @@ -64,9 +67,8 @@ | ||
| 64 | 67 | } |
| 65 | 68 | } |
| 66 | 69 | |
| 67 | 70 | return true; |
| 68 | - | |
| 69 | 71 | } |
| 70 | 72 | |
| 71 | 73 | /** |
| 72 | 74 | * |