Skip to content

Commit

Permalink
remove unneeded wp editor dependency in newer versions of wordpress
Browse files Browse the repository at this point in the history
  • Loading branch information
tschortsch committed Jul 29, 2021
1 parent 07e9dbb commit 6f34e9c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/class-wp-bootstrap-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,13 @@ public function enqueue_block_editor_assets() {

$index_dependencies = isset( $index_asset['dependencies'] ) ? $index_asset['dependencies'] : array();
global $wp_version;
if ( version_compare( $wp_version, '5.2', '<' ) ) {
// We have to filter out the dependency to 'wp-block-editor' since it's not available in WordPress 5.1 and older.
$index_dependencies = array_filter(
$index_dependencies,
function ( $dependency ) {
return 'wp-block-editor' !== $dependency;
}
);
}
$wp_editor_dependency_to_remove = version_compare( $wp_version, '5.2', '<' ) ? 'wp-block-editor' : 'wp-editor';
$index_dependencies = array_filter(
$index_dependencies,
function ( $dependency ) use ( $wp_editor_dependency_to_remove ) {
return $wp_editor_dependency_to_remove !== $dependency;
}
);

$index_version = isset( $index_asset['version'] ) ? $index_asset['version'] : filemtime( $index_path );

Expand Down

0 comments on commit 6f34e9c

Please sign in to comment.