Skip to content

Commit 8c48174

Browse files
authored
Merge pull request #80 from Automattic/add/min-wp-php-notice
Add min php and wp notice
2 parents 3ede143 + 8dcefda commit 8c48174

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

vip-block-data-api.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Access Gutenberg block data in JSON via the REST API.
66
* Author: WordPress VIP
77
* Text Domain: vip-block-data-api
8-
* Version: 1.4.1
8+
* Version: 1.4.2
99
* Requires at least: 6.0
1010
* Tested up to: 6.6
1111
* Requires PHP: 8.0
@@ -20,7 +20,20 @@
2020
if ( ! defined( 'VIP_BLOCK_DATA_API_LOADED' ) ) {
2121
define( 'VIP_BLOCK_DATA_API_LOADED', true );
2222

23-
define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.4.1' );
23+
// ToDo: When 6.4 is our min version, switch to wp_admin_notice.
24+
global $wp_version;
25+
if ( version_compare( phpversion(), '8.0', '<' ) || version_compare( $wp_version, '6.0', '<' ) ) {
26+
add_action( 'admin_notices', function () {
27+
?>
28+
<div class="notice notice-error">
29+
<p><?php esc_html_e( 'VIP Block Data API requires PHP 8.0+ and WordPress 6.0+.', 'vip-block-data-api' ); ?></p>
30+
</div>
31+
<?php
32+
}, 10, 0 );
33+
return;
34+
}
35+
36+
define( 'WPCOMVIP__BLOCK_DATA_API__PLUGIN_VERSION', '1.4.2' );
2437
define( 'WPCOMVIP__BLOCK_DATA_API__REST_ROUTE', 'vip-block-data-api/v1' );
2538

2639
// Analytics related configs.

0 commit comments

Comments
 (0)