Automattic\WooCommerce\Blueprint
Util::is_valid_wp_plugin_slug
Check to see if given string is a valid WordPress plugin slug.
Method of the class: Util{}
No Hooks.
Returns
true|false
.
Usage
$result = Util::is_valid_wp_plugin_slug( $slug );
- $slug(string) (required)
- The slug to be validated.
Util::is_valid_wp_plugin_slug() Util::is valid wp plugin slug code WC 9.9.5
public static function is_valid_wp_plugin_slug( $slug ) { // Check if the slug only contains allowed characters. if ( preg_match( '/^[a-z0-9-]+$/', $slug ) ) { return true; } return false; }