wp_sitemaps_enabled

過濾鉤子
apply_filters( 'wp_sitemaps_enabled', $is_enabled )
引數
  • (bool) $is_enabled Whether XML Sitemaps are enabled or not. Defaults to true for public sites.
    Required:
定義位置
相關勾子
wp_sitemaps_initwp_sitemaps_max_urlswp_sitemaps_taxonomieswp_sitemaps_posts_entrywp_sitemaps_index_entry
相關方法
wp_revisions_enabledwp_sitemaps_get_max_urlswp_sitemaps_get_serverglobal_terms_enabledwp_is_site_initialized_wp_sidebars_changed
引入
5.5.0
棄用
-

wp_sitemaps_enabled是一個返回站點地圖是否在當前 WordPress 安裝中啟用的函式。此功能可用於檢查站點地圖是否已啟用,並根據該資訊採取不同的操作。

過濾是否啟用了XML Sitemaps。

當通過該過濾器禁用XML Sitemaps時,重寫規則仍在發揮作用,以確保返回404。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled );
return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled );
return (bool) apply_filters( 'wp_sitemaps_enabled', $is_enabled );

常見問題

FAQs
檢視更多 >