Skip to content

Instantly share code, notes, and snippets.

@mimosafa
Created March 11, 2014 18:01
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 mimosafa/9491410 to your computer and use it in GitHub Desktop.
Save mimosafa/9491410 to your computer and use it in GitHub Desktop.
WordPress, 未ログインユーザーは拒否。ただし、特定のIPアドレスからのアクセスは許可する。
<?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