检查wp-content目录并使用任何插件数据检索所有drop-ins。

原型

get_dropins()

返回值

(array)  Key是文件路径,值是插件数据的数组。

源文件

路径:wp-admin/includes/plugin.php

<?php
...
function get_dropins() {
	$dropins = array();
	$plugin_files = array();
	$_dropins = _get_dropins();
	// These exist in the wp-content directory
	if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) {
		while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
			if ( isset( $_dropins[ $file ] ) )
				$plugin_files[] = $file;
		}
	} else {
		return $dropins;
	}
	@closedir( $plugins_dir );
	if ( empty($plugin_files) )
		return $dropins;
	foreach ( $plugin_files as $plugin_file ) {
		if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) )
			continue;
		$plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.
		if ( empty( $plugin_data['Name'] ) )
			$plugin_data['Name'] = $plugin_file;
		$dropins[ $plugin_file ] = $plugin_data;
	}
	uksort( $dropins, 'strnatcasecmp' );
	return $dropins;
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_dropins/