1
我已經停用搜索,作者,日期和標籤存檔我的WordPress網站與此網頁了Noindex
add_action('template_redirect', 'remove_wp_archives');
function remove_wp_archives(){
if(is_tag() || is_attachment() || is_author() || is_date()) {
global $wp_query;
$wp_query->set_404();
}
}
這
function fastwp_filter_query($query, $error = true) {
if (is_search()) {
$query->is_search = false;
$query->query_vars[s] = false;
$query->query[s] = false;
// to error
if ($error == true)
$query->is_404 = true;
}
}
add_action('parse_query', 'fastwp_filter_query');
add_filter('get_search_form', create_function('$a', "return null;"));
我的問題:通常我會NOINDEX一定頁面像作者檔案等在我head.php爲搜索引擎優化的目的,但如果我已通過函數停用它,我仍然需要將其設置爲noindex在我的head.php?
這是我的網站與我是唯一一個登錄,所以沒有與其他用戶的問題。我的目的插件太臃腫。我應該如何檢查我已停用的頁面上的noindex?返回404與我的功能。 –