debug_information

过滤钩子
apply_filters( 'debug_information', $info )
参数
  • (array) $args { The debug information to be added to the core information page. This is an associative multi-dimensional array, up to three levels deep. The topmost array holds the sections, keyed by section ID. @type array ...$0 { Each section has a `$fields` associative array (see below), and each `$value` in `$fields` can be another associative array of name/value pairs when there is more structured data to display. @type string $label Required. The title for this section of the debug output. @type string $description Optional. A description for your information section which may contain basic HTML markup, inline tags only as it is outputted in a paragraph. @type bool $show_count Optional. If set to `true`, the amount of fields will be included in the title for this section. Default false. @type bool $private Optional. If set to `true`, the section and all associated fields will be excluded from the copied data. Default false. @type array $fields { Required. An associative array containing the fields to be displayed in the section, keyed by field ID. @type array ...$0 { An associative array containing the data to be displayed for the field. @type string $label Required. The label for this piece of information. @type mixed $value Required. The output that is displayed for this field. Text should be translated. Can be an associative array that is displayed as name/value pairs. Accepted types: `string|int|float|(string|int|float)[]`. @type string $debug Optional. The output that is used for this field when the user copies the data. It should be more concise and not translated. If not set, the content of `$value` is used. Note that the array keys are used as labels for the copied data. @type bool $private Optional. If set to `true`, the field will be excluded from the copied data, allowing you to show, for example, API keys here. Default false. } } } }
    Required:
定义位置
相关勾子
login_form_actiondate_formatsattach_session_informationlogin_form_topadded_option
相关方法
install_plugin_informationdebug_fopeninstall_theme_informationdebug_fwriteget_linkratingdelete_blog_option
引入
5.2.0
弃用
-

debug_information。这个动作钩子用于在WordPress调试日志中添加调试信息。它被error_log函数调用,可以用来记录调试网站时可能有用的信息。

过滤显示在工具->站点健康->信息屏幕上的调试信息。

插件或主题可能希望引入他们自己的调试信息,而不创建额外的管理页面。他们可以利用这个过滤器来引入他们自己的部分或为现有的部分添加更多的数据。

由核心添加的部分的数组键都是以 wp-. 为前缀。插件和主题应该使用他们自己的slug作为前缀,这既是为了一致性,也是为了避免键的冲突。请注意,数组的键是作为复制数据的标签使用的。

除了 $description 可以包含内嵌的HTML标签(见下文),所有字符串都应该是纯文本。

$info = apply_filters( 'debug_information', $info );

常见问题

FAQs
查看更多 >