Skip to content

Instantly share code, notes, and snippets.

@alexdeborba
Created March 30, 2020 19:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexdeborba/433ed2a6cf2d4896a81ced152ca6b523 to your computer and use it in GitHub Desktop.
Save alexdeborba/433ed2a6cf2d4896a81ced152ca6b523 to your computer and use it in GitHub Desktop.
if(
strpos( $_SERVER['HTTP_REFERER'], 'wp-admin' ) === false &&
strpos( $_SERVER['REQUEST_URI'], 'admin-ajax.php' ) !== false
) {
header( 'Cache-Control: max-age=30000, must-revalidate' );
header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', strtotime( '+5000 minutes' ) ) . ' GMT' );
header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', strtotime( '-5000 minutes' ) ) . ' GMT' );
header( $_SERVER["SERVER_PROTOCOL"]." 404 Not Found" );
die;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment