Skip to content

Commit

Permalink
Add a notice when the min WP version is not met (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeniumed authored Sep 16, 2024
1 parent 44c1589 commit 83b6932
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
vendor
*.php
dist
8 changes: 4 additions & 4 deletions vip-workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

define( 'VIP_WORKFLOW_LOADED', true );

// ToDo: Add a check for the WP version as well.
// ToDo: When 6.4 is our min version, switch to wp_admin_notice.
if ( version_compare( phpversion(), '8.0', '<' ) ) {
global $wp_version;
if ( version_compare( phpversion(), '8.0', '<' ) || version_compare( $wp_version, '6.2', '<' ) ) {
add_action( 'admin_notices', function () {
?>
<div class="notice notice-error">
<p><?php esc_html_e( 'VIP Workflow requires PHP 8.0+.', 'vip-workflow' ); ?></p>
</div>
<p><?php esc_html_e( 'VIP Workflow requires PHP 8.0+ and WordPress 6.2+.', 'vip-workflow' ); ?></p>
</div>
<?php
}, 10, 0 );
return;
Expand Down

0 comments on commit 83b6932

Please sign in to comment.