On this page
WP_REST_Plugins_Controller::sanitize_plugin_param( string $file ): string
Sanitizes the “plugin” parameter to be a proper plugin file with “.php” appended.
Parameters
$filestring Required-
The plugin file parameter.
Return
string
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-plugins-controller.php. View all references
public function sanitize_plugin_param( $file ) {
return plugin_basename( sanitize_text_field( $file . '.php' ) );
}
Related
Uses
| Uses | Description |
|---|---|
| sanitize_text_field() wp-includes/formatting.php | Sanitizes a string from user input or from the database. |
| plugin_basename() wp-includes/plugin.php | Gets the basename of a plugin. |
Changelog
| Version | Description |
|---|---|
| 5.5.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_plugins_controller/sanitize_plugin_param