При анализе страниц сайта в панели управления Яндекс ВебМастер часто можно встретить адреса
/wp-json/oembed/1.0/embed . Такие адреса могут портить статистику индексирования или вводить смуту в понимание работы seo. Если вы не знакомы с технологией WP Rest API и вам не требуется эта возможность, но вы хотите избавиться от подобных ссылок. Тогда код ниже для вас.
Допишите его в файл function.php вашей темы WordPress.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
remove_action('xmlrpc_rsd_apis', 'rest_output_rsd'); remove_action('wp_head', 'rest_output_link_wp_head', 10, 0); remove_action('template_redirect', 'rest_output_link_header', 11, 0); remove_action('auth_cookie_malformed', 'rest_cookie_collect_status'); remove_action('auth_cookie_expired', 'rest_cookie_collect_status'); remove_action('auth_cookie_bad_username', 'rest_cookie_collect_status'); remove_action('auth_cookie_bad_hash', 'rest_cookie_collect_status'); remove_action('auth_cookie_valid', 'rest_cookie_collect_status'); remove_filter('rest_authentication_errors', 'rest_cookie_check_errors', 100); remove_action('init', 'rest_api_init'); remove_action('rest_api_init', 'rest_api_default_filters', 10, 1); remove_action('parse_request', 'rest_api_loaded'); remove_action('rest_api_init', 'wp_oembed_register_route'); remove_filter('rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4); remove_action('wp_head', 'wp_oembed_add_discovery_links'); remove_action('wp_head', 'wp_oembed_add_host_js'); |