ユーザーIDを隠す方法

WordPressサイト運営に関わる事項

functions.php を編集

参考にしたURL
https://webst8.com/blog/wordpress-author-setting/

functions.php のパス

wp-content\themes\テーマのフォルダ\functions.php

追記内容

add_filter('author_rewrite_rules','__return_empty_array');
functiondisable_author_archive(){
if($_GET['author']||preg_match('#/author/.+#',$_SERVER['REQUEST_URI']))
{
wp_redirect(home_url('/404.php'));
exit;
}
}
add_action('init','disable_author_archive');

コメント

タイトルとURLをコピーしました