-
Notifications
You must be signed in to change notification settings - Fork 219
Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+ #10360
Check if WordPress version is higher than 6.2.2 to make Products block compatible with Gutenberg 16+ #10360
Changes from 1 commit
4381994
fee90dc
cc4dbdd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -91,6 +91,14 @@ protected function initialize() { | |||||
protected function enqueue_data( array $attributes = [] ) { | ||||||
parent::enqueue_data( $attributes ); | ||||||
|
||||||
if ( version_compare( $GLOBALS['wp_version'], '6.2.2', '>' ) ) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you sure that this check is correct? Should be
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
But you're right, I cannot compare to 6.2.2, because there may be another 6.2.x release and there will be incorrect behaviour. I'll try to use this custom function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
TIL
Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, code updated! And I updated testing steps to cover cases with higher and lower than WP 6.3 + Gutenberg 16 enabled and disabled. |
||||||
$this->asset_data_registry->add( | ||||||
'post_template_has_support_for_grid_view', | ||||||
true | ||||||
); | ||||||
return; | ||||||
} | ||||||
|
||||||
$gutenberg_version = ''; | ||||||
|
||||||
if ( is_plugin_active( 'gutenberg/gutenberg.php' ) ) { | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: Should we put both logic in a dedicated function and add a comment? (it would be great just the link to this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! I extracted the logic to separate function, do you mind taking a look one more time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that we should fix the check for the WP version :D