Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active January 9, 2018 16:50
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 wpscholar/1281497 to your computer and use it in GitHub Desktop.
Save wpscholar/1281497 to your computer and use it in GitHub Desktop.
Force WordPress to return a 404 status
<?php
/**
* Force WordPress to return a 404 status
*/
global $wp_query;
$wp_query->set_404();
status_header( 404 );
nocache_headers();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment