noindex

函式
noindex ( No parameters )
相關
  • wp_no_robots()
定義位置
相關方法
drop_indexwp_robots_noindexadd_clean_indexlogin_headerdomain_exists
引入
2.1.0
棄用
5.7.0

noindex: 這個函式生成一個noindex元標籤,用於WordPress頁面的HTML頭部部分。它用於指示搜尋引擎不要索引該頁面。

如果部落格配置需要,顯示一個`noindex`元標籤。

如果一個部落格被標記為不公開,那麼”noindex”元標籤將被輸出,告訴網路機器人不要索引該頁面內容。

典型的用法是作為{@see ‘wp_head’}的回撥。

add_action( ‘wp_head’, ‘noindex’);

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function noindex() {
_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );
// If the blog is not public, tell robots to go away.
if ( '0' == get_option( 'blog_public' ) ) {
wp_no_robots();
}
}
function noindex() { _deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' ); // If the blog is not public, tell robots to go away. if ( '0' == get_option( 'blog_public' ) ) { wp_no_robots(); } }
function noindex() {
	_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );

	// If the blog is not public, tell robots to go away.
	if ( '0' == get_option( 'blog_public' ) ) {
		wp_no_robots();
	}
}

常見問題

FAQs
檢視更多 >