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()提前返回该值。

$prepared_themes = (array) apply_filters( 'pre_prepare_themes_for_js', array(), $themes, $current_theme );

常见问题

FAQs
查看更多 >