7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

未ログインユーザーは拒否。ただし、特定のIPアドレスからのアクセスは許可する。

Last updated at Posted at 2014-04-15
functions.php
function mmsf_404_redirect() {
	$your_remote_addr = '00.0.000.00'; // アクセスを許可するIPアドレス
	if ( is_user_logged_in() || $_SERVER['REMOTE_ADDR'] === $your_remote_addr )
		return;
	wp_redirect( 'http://example.com', '404' ); // 任意のURL
}
add_action( 'init', 'mmsf_404_redirect' );

gist

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?