wp_script_is()判断一个脚本是否已经注册/加载/输出

目录

描述

Determine if a script has been registered, enqueued, printed, or is waiting to be printed. Very useful when registering/enqueing scripts in plugins to avoid conflicts with other plugin scripts.

wp_script_is() 描述

用法

<?php wp_script_is$handle$list 'enqueued' ); ?>

wp_script_is() 用法

参数

$handle

(string) (必填) Name of the script. Lowercase string.

默认值: None

$list

(string) (可选) The list to query.

  • registered - script was registered through wp_register_script()
  • enqueued / queue - script was enqueued
  • done - script has been printed
  • to_do - script has not yet been printed

默认值: enqueued

wp_script_is() 参数

返回值

(bool) 

True or false.

wp_script_is() 返回值

历史

wp_script_is() 历史

源文件

wp_script_is() 函数的代码位于 wp-includes/functions.wp-scripts.php.

wp_script_is() 源文件

相关