Uses
Uses | Description |
---|---|
wp-admin/includes/plugin.php: get_plugins() | Check the plugins directory and retrieve all plugin files with plugin data. |
Finds an installed plugin for the given slug.
(string) (Required) The WordPress.org directory slug for a plugin.
(string) The plugin file found matching it.
File: wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
protected function find_plugin_for_slug( $slug ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; $plugin_files = get_plugins( '/' . $slug ); if ( ! $plugin_files ) { return ''; } $plugin_files = array_keys( $plugin_files ); return $slug . '/' . reset( $plugin_files ); }
Version | Description |
---|---|
5.5.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_block_directory_controller/find_plugin_for_slug