site_status_tests

过滤钩子
apply_filters( 'site_status_tests', $tests )
参数
  • (array[]) $tests { An associative array of direct and asynchronous tests. @type array[] $direct { An array of direct tests. @type array ...$identifier { `$identifier` should be a unique identifier for the test. Plugins and themes are encouraged to prefix test identifiers with their slug to avoid collisions between tests. @type string $label The friendly label to identify the test. @type callable $test The callback function that runs the test and returns its result. @type bool $skip_cron Whether to skip this test when running as cron. } } @type array[] $async { An array of asynchronous tests. @type array ...$identifier { `$identifier` should be a unique identifier for the test. Plugins and themes are encouraged to prefix test identifiers with their slug to avoid collisions between tests. @type string $label The friendly label to identify the test. @type string $test An admin-ajax.php action to be called to perform the test, or if `$has_rest` is true, a URL to a REST API endpoint to perform the test. @type bool $has_rest Whether the `$test` property points to a REST API endpoint. @type bool $skip_cron Whether to skip this test when running as cron. @type callable $async_direct_test A manner of directly calling the test marked as asynchronous, as the scheduled event can not authenticate, and endpoints may require authentication. } } }
    Required:
定义位置
相关勾子
site_status_test_resultsite_status_test_php_modulesdisplay_site_statesuse_streams_transportsite_icon_meta_tags
相关方法
get_page_statuses_post_statesget_sitestatsget_post_statusespost_comment_status_meta_boxwp_sanitize_script_attributes
引入
5.6.0
弃用
-

site_status_tests: 这是一个过滤钩子,允许你修改由网站健康工具执行的测试列表。网站健康工具提供关于你的网站及其环境的健康信息。

筛选在站点上运行的站点状态测试。

站点运行状况由基于以下最佳实践的一组测试确定:WordPress托管团队和web标准。

某些站点可能没有相同的要求,例如自动更新检查可能由主机处理,因此在内核中被禁用。或者您可能想引入一个新的测试,例如,是否启用/禁用/过时缓存。

可以将测试添加为直接测试或异步测试。任何可能需要一些时间才能完成的测试都应该异步运行,以避免wp-admin中的加载时间延长。

$tests = apply_filters( 'site_status_tests', $tests );

常见问题

FAQs
查看更多 >