Last active
December 30, 2015 04:39
-
-
Save josephabrahams/7777449 to your computer and use it in GitHub Desktop.
404 all WordPress requests that don't match a theme template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$f_path = dirname( realpath( __FILE__ ) ) . '/../../../404.html'; | |
if ( file_exists( $f_path ) ) { | |
readfile( $f_path ); | |
} else { | |
echo '<h1>404 Not Found</h1>'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wp_query; | |
$wp_query->set_404(); | |
status_header( 404 ); | |
get_template_part( 404 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/styleguide/templates/2.0