pre_prepare_themes_for_js

過濾鉤子
apply_filters( 'pre_prepare_themes_for_js', array()
引數
  • (array) $prepared_themes An associative array of theme data. Default empty array.
    Required:
  • (WP_Theme[]|null) $themes An array of theme objects to prepare, if any.
    Required:
  • (string) $current_theme The active theme slug.
    Required:
定義位置
相關勾子
wp_prepare_themes_for_jswp_prepare_revision_for_jsrest_prepare_themerest_prepare_attachmentrest_prepare_user
相關方法
wp_prepare_themes_for_jswp_prepare_attachment_for_jswp_prepare_revisions_for_jsget_parent_theme_file_uriget_parent_theme_file_pathwp_update_themes
引入
4.2.0
棄用
-

pre_prepare_themes_for_js:這個過濾器用來過濾傳遞給WordPress定製器的JavaScript程式碼的主題陣列。這允許開發人員修改傳遞給JavaScript程式碼的主題,例如,從自定義器的可用主題列表中排除某些主題。

在為JavaScript做準備之前過濾主題資料。

傳遞非空陣列將導致wp_prepare_themes_fr_js()提前返回該值。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );
$prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );
$prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );

常見問題

FAQs
檢視更多 >