WP_REST_Plugins_Controller::validate_plugin_param()
Checks that the "plugin" parameter is a valid path.
Method of the class: WP_REST_Plugins_Controller{}
No Hooks.
Return
true|false
.
Usage
$WP_REST_Plugins_Controller = new WP_REST_Plugins_Controller(); $WP_REST_Plugins_Controller->validate_plugin_param( $file );
- $file(string) (required)
- The plugin file parameter.
Changelog
Since 5.5.0 | Introduced. |
WP_REST_Plugins_Controller::validate_plugin_param() WP REST Plugins Controller::validate plugin param code WP 6.6.2
public function validate_plugin_param( $file ) { if ( ! is_string( $file ) || ! preg_match( '/' . self::PATTERN . '/u', $file ) ) { return false; } $validated = validate_file( plugin_basename( $file ) ); return 0 === $validated; }