钩子文档

print_head_scripts

💡 云策文档标注

概述

print_head_scripts 是一个 WordPress 过滤器,用于控制是否在管理页面的 HTML head 部分打印脚本队列。它允许开发者根据条件动态启用或禁用脚本输出。

关键要点

  • 这是一个过滤器 Hook,用于修改是否打印 head 脚本的布尔值。
  • 参数 $print 是一个布尔值,默认为 true,表示默认打印脚本。
  • 在 WordPress 2.8.0 版本中引入,位于 wp-includes/script-loader.php 文件中。
  • 与 print_head_scripts() 函数相关,该函数在管理页面打印脚本队列。

📄 原文内容

Filters whether to print the head scripts.

Parameters

$printbool
Whether to print the head scripts. Default true.

Source

if ( apply_filters( 'print_head_scripts', true ) ) {

Changelog

Version Description
2.8.0 Introduced.