Last active
October 17, 2017 16:18
-
-
Save lifoolgh/4068beaea5b61b9b6f27e876dbeb7b14 to your computer and use it in GitHub Desktop.
attachmentページでステータス404を返す
This file contains 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
// attachmentページでステータス404を返す | |
add_action( 'template_redirect', 'status404' ); | |
function status404() { | |
// attachmentページだった場合 | |
if ( is_attachment() ) { | |
global $wp_query; | |
$wp_query->set_404(); | |
status_header(404); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment