The get_dropins() WordPress PHP function checks the wp-content directory and retrieves all drop-ins with any plugin data.
Usage
$dropins = get_dropins();
Parameters
- None
More information
See WordPress Developer Resources: get_dropins()
Examples
Display Drop-ins List
This example retrieves all drop-ins and displays them in a list.
$dropins = get_dropins(); if (!empty($dropins)) { echo '<ul>'; foreach ($dropins as $file => $info) { echo '<li><strong>' . $info['Name'] . '</strong> - ' . $info['Description'] . '</li>'; } echo '</ul>'; } else { echo 'No drop-ins found.'; }
Count Drop-ins
This example counts the number of drop-ins and displays the result.
$dropins = get_dropins(); $count = count($dropins); echo 'There are ' . $count . ' drop-ins installed.';
Check if a Specific Drop-in is Installed
This example checks if a specific drop-in called “custom-dropin.php” is installed.
$dropins = get_dropins(); if (array_key_exists('custom-dropin.php', $dropins)) { echo 'The custom-dropin.php drop-in is installed.'; } else { echo 'The custom-dropin.php drop-in is not installed.'; }
Display Drop-ins Version
This example retrieves all drop-ins and displays their version information.
$dropins = get_dropins(); if (!empty($dropins)) { echo '<ul>'; foreach ($dropins as $file => $info) { echo '<li><strong>' . $info['Name'] . '</strong> - Version: ' . $info['Version'] . '</li>'; } echo '</ul>'; } else { echo 'No drop-ins found.'; }
Display Drop-ins Author
This example retrieves all drop-ins and displays their author information.
$dropins = get_dropins(); if (!empty($dropins)) { echo '<ul>'; foreach ($dropins as $file => $info) { echo '<li><strong>' . $info['Name'] . '</strong> - Author: ' . $info['Author'] . '</li>'; } echo '</ul>'; } else { echo 'No drop-ins found.'; }