diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index ce913919da6e6..2b77846f8b10a 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -1119,12 +1119,10 @@ function validate_plugin( $plugin ) { * Uses the information from `Requires at least` and `Requires PHP` headers * defined in the plugin's main PHP file. * - * If the headers are not present in the plugin's main PHP file, - * `readme.txt` is also checked as a fallback. - * * @since 5.2.0 * @since 5.3.0 Added support for reading the headers from the plugin's * main PHP file, with `readme.txt` as a fallback. + * @since 5.8.0 Removed support for using `readme.txt` as a fallback. * * @param string $plugin Path to the plugin file relative to the plugins directory. * @return true|WP_Error True if requirements are met, WP_Error on failure. @@ -1137,21 +1135,6 @@ function validate_plugin_requirements( $plugin ) { 'requires_php' => ! empty( $plugin_headers['RequiresPHP'] ) ? $plugin_headers['RequiresPHP'] : '', ); - $readme_file = WP_PLUGIN_DIR . '/' . dirname( $plugin ) . '/readme.txt'; - - if ( file_exists( $readme_file ) ) { - $readme_headers = get_file_data( - $readme_file, - array( - 'requires' => 'Requires at least', - 'requires_php' => 'Requires PHP', - ), - 'plugin' - ); - - $requirements = array_merge( $readme_headers, $requirements ); - } - $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] ); diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index 458b8e6b3a403..7d4b62684ba59 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -899,10 +899,8 @@ function validate_current_theme() { * Uses the information from `Requires at least` and `Requires PHP` headers * defined in the theme's `style.css` file. * - * If the headers are not present in the theme's stylesheet file, - * `readme.txt` is also checked as a fallback. - * * @since 5.5.0 + * @since 5.8.0 Removed support for using `readme.txt` as a fallback. * * @param string $stylesheet Directory name for the theme. * @return true|WP_Error True if requirements are met, WP_Error on failure. @@ -915,21 +913,6 @@ function validate_theme_requirements( $stylesheet ) { 'requires_php' => ! empty( $theme->get( 'RequiresPHP' ) ) ? $theme->get( 'RequiresPHP' ) : '', ); - $readme_file = $theme->theme_root . '/' . $stylesheet . '/readme.txt'; - - if ( file_exists( $readme_file ) ) { - $readme_headers = get_file_data( - $readme_file, - array( - 'requires' => 'Requires at least', - 'requires_php' => 'Requires PHP', - ), - 'theme' - ); - - $requirements = array_merge( $readme_headers, $requirements ); - } - $compatible_wp = is_wp_version_compatible( $requirements['requires'] ); $compatible_php = is_php_version_compatible( $requirements['requires_php'] );