Skip to content

Commit

Permalink
Use installed version as fallback for WordPress version
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Jan 23, 2024
1 parent 9b12892 commit 8a66156
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions includes/Checker/Checks/Plugin_Readme_Check.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,18 @@ private function get_wordpress_stable_version() {
}
}

// If $version is still false at this point, use current installed WordPress version.
if ( false === $version ) {
$version = get_bloginfo( 'version' );

Check warning on line 309 in includes/Checker/Checks/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Readme_Check.php#L309

Added line #L309 was not covered by tests

// Strip off any -alpha, -RC, -beta suffixes.
list( $version, ) = explode( '-', $version );

Check warning on line 312 in includes/Checker/Checks/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Readme_Check.php#L312

Added line #L312 was not covered by tests

if ( preg_match( '#^\d.\d#', $version, $matches ) ) {
$version = $matches[0];

Check warning on line 315 in includes/Checker/Checks/Plugin_Readme_Check.php

View check run for this annotation

Codecov / codecov/patch

includes/Checker/Checks/Plugin_Readme_Check.php#L314-L315

Added lines #L314 - L315 were not covered by tests
}
}

return $version;
}
}

0 comments on commit 8a66156

Please sign in to comment.