WordPressで投稿者アーカイブ、ユーザー情報APIを無効化する
TL;DR
パーマリンク設定及び/wp-sitemap.xml
のサイトマップから投稿者アーカイブを除去
さらに?author=
のURLパラメータ付与によるユーザー名による投稿の検索も無効化し
/wp-json/wp/v2/users/
のリクエストも無効化します。
add_filter('wp_sitemaps_users_pre_url_list',function(){return [];});
add_filter('wp_sitemaps_users_pre_max_num_pages',function(){return 0;});
add_filter('author_rewrite_rules',function(){return [];});
add_filter('query_vars',function($vars){return array_diff($vars,['author','author_name']);});
add_filter('rest_prepare_user',function(){return new WP_REST_Response(['message'=>'404 not found')],404);});
Author And Source
この問題について(WordPressで投稿者アーカイブ、ユーザー情報APIを無効化する), 我々は、より多くの情報をここで見つけました https://qiita.com/synchro_vision/items/c46b6cb333b70393d492著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .