_get_dropins()
云策文档标注
概述
_get_dropins() 函数返回 WordPress 使用的 drop-in 插件列表,包括标准 drop-ins 和仅在多站点环境下可用的 drop-ins。
关键要点
- 函数返回一个数组,键为文件名,值为包含 drop-in 插件描述和所需常量的数组。
- 当 is_multisite() 返回 true 时,会包含多站点专用的 drop-ins,如 sunrise.php。
- 每个 drop-in 插件的数据格式为数组,包含描述字符串和必须为 true 的常量名(或 true 表示无常量要求)。
代码示例
function _get_dropins() {
$dropins = array(
'advanced-cache.php' => array( __( 'Advanced caching plugin.' ), 'WP_CACHE' ),
'db.php' => array( __( 'Custom database class.' ), true ),
'db-error.php' => array( __( 'Custom database error message.' ), true ),
'install.php' => array( __( 'Custom installation script.' ), true ),
'maintenance.php' => array( __( 'Custom maintenance message.' ), true ),
'object-cache.php' => array( __( 'External object cache.' ), true ),
'php-error.php' => array( __( 'Custom PHP error message.' ), true ),
'fatal-error-handler.php' => array( __( 'Custom PHP fatal error handler.' ), true ),
);
if ( is_multisite() ) {
$dropins['sunrise.php'] = array( __( 'Executed before Multisite is loaded.' ), 'SUNRISE' );
$dropins['blog-deleted.php'] = array( __( 'Custom site deleted message.' ), true );
$dropins['blog-inactive.php'] = array( __( 'Custom site inactive message.' ), true );
$dropins['blog-suspended.php'] = array( __( 'Custom site suspended message.' ), true );
}
return $dropins;
}
原文内容
Returns drop-in plugins that WordPress uses.
Description
Includes Multisite drop-ins only when is_multisite()
User Contributed Notes
You must log in before being able to contribute a note or feedback.