Created
March 11, 2014 18:01
-
-
Save mimosafa/9491410 to your computer and use it in GitHub Desktop.
WordPress, 未ログインユーザーは拒否。ただし、特定のIPアドレスからのアクセスは許可する。
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
<?php | |
$your_remote_addr = '00.0.000.00'; | |
function mmsf_404_redirect() { | |
if ( is_user_logged_in() || $_SERVER['REMOTE_ADDR'] === $your_remote_addr ) | |
return; | |
wp_redirect( 'http://example.com', '404' ); | |
} | |
add_action( 'init', 'mmsf_404_redirect' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment