wp_robots_max_image_preview_large

函式
wp_robots_max_image_preview_large ( $robots )
引數
  • (array) $robots Associative array of robots directives.
    Required:
返回值
  • (array) Filtered robots directives.
定義位置
相關方法
wp_ajax_imgedit_previewwp_robots_sensitive_pagewp_save_image_filewp_ajax_image_editormedia_upload_max_image_resize
引入
5.7.0
棄用
-

wp_robots_max_image_preview_large: 這是一個WordPress的過濾鉤子,用於控制robots.txt檔案中的最大影象預覽設定。它用於控制搜尋引擎是否可以在搜尋結果中顯示大的影象預覽。

在robots元標籤中新增`max-image-preview:large`。

這個指令告訴網路機器人,除非部落格被標記為不公開,否則允許在搜尋引擎中顯示大圖片預覽。

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

add_filter( ‘wp_robots’, ‘wp_robots_max_image_preview_large’ );

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_robots_max_image_preview_large( array $robots ) {
if ( get_option( 'blog_public' ) ) {
$robots['max-image-preview'] = 'large';
}
return $robots;
}
function wp_robots_max_image_preview_large( array $robots ) { if ( get_option( 'blog_public' ) ) { $robots['max-image-preview'] = 'large'; } return $robots; }
function wp_robots_max_image_preview_large( array $robots ) {
	if ( get_option( 'blog_public' ) ) {
		$robots['max-image-preview'] = 'large';
	}
	return $robots;
}

常見問題

FAQs
檢視更多 >