Skip to content

Instantly share code, notes, and snippets.

@iamgabrielma
Created February 3, 2019 11:26
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 iamgabrielma/2eb8cd2a1b5352e5bf444211b569a345 to your computer and use it in GitHub Desktop.
Save iamgabrielma/2eb8cd2a1b5352e5bf444211b569a345 to your computer and use it in GitHub Desktop.
DMCA-WP to disable specific page/content
/*
Plugin Name: DMCA content removal
Description: For DMCA content removal requests
Author: aaron-p9F6qB-2oq-p2
*/
function wpcom_dmca() {
if ( is_single( 1057 ) ) {
global $wp_query;
$wp_query->set_404();
//This results in 451 headers being sent and a 404 message displayed
status_header(451);
nocache_headers();
}
}
add_action( 'wp', 'wpcom_dmca' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment