Plugins and Themes: Add filters to validation functions.

It is now possible to add additional validation requirements for themes and plugins besides the built in core checks.

Developed in https://github.com/WordPress/wordpress-develop/pull/1812 and https://github.com/WordPress/wordpress-develop/pull/10361.

Props kraftbj, mukesh27, jorbin, joedolson.
Fixes #54381.

Built from https://develop.svn.wordpress.org/trunk@60995


git-svn-id: http://core.svn.wordpress.org/trunk@60331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Aaron Jorbin
2025-10-20 22:31:27 +00:00
parent e3b7bff1c1
commit 4f4e28a421
3 changed files with 29 additions and 3 deletions

View File

@@ -1247,7 +1247,20 @@ function validate_plugin_requirements( $plugin ) {
);
}
return true;
/**
* Filters the plugin requirement validation response.
*
* If a plugin fails due to a Core-provided validation (incompatible WP, PHP versions), this
* filter will not fire. A WP_Error response will already be returned.
*
* This filter is intended to add additional validation steps by site administrators.
*
* @since 6.9.0
*
* @param bool|WP_Error $met_requirements True if the plugin meets requirements, WP_Error if not.
* @param string $plugin Path to the plugin file relative to the plugins directory.
*/
return apply_filters( 'validate_plugin_requirements', true, $plugin );
}
/**

View File

@@ -1002,7 +1002,20 @@ function validate_theme_requirements( $stylesheet ) {
);
}
return true;
/**
* Filters the theme requirement validation response.
*
* If a theme fails due to a Core-provided validation (incompatible WP, PHP versions), this
* filter will not fire. A WP_Error response will already be returned.
*
* This filter is intended to add additional validation steps by site administrators.
*
* @since 6.9.0
*
* @param bool|WP_Error $met_requirements True if the theme meets requirements, WP_Error if not.
* @param string $stylesheet Directory name for the theme.
*/
return apply_filters( 'validate_theme_requirements', true, $stylesheet );
}
/**

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.9-alpha-60994';
$wp_version = '6.9-alpha-60995';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.