Skip to content

Commit 737d72f

Browse files
fix: add check and trigger error if autoload is not found (#21)
* fix: add check and trigger error if autoload is not found * fix: update changelog --------- Co-authored-by: troychaplin <[email protected]>
1 parent 7825b44 commit 737d72f

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

CHANGELOG.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
Prefix the change with one of these keywords:
99

10-
- _Added_: for new features.
11-
- _Breaking_: for higher visibility of breaking changes
12-
- _Changed_: for changes in existing functionality.
13-
- _Deprecated_: for soon-to-be removed features.
14-
- _Removed_: for now removed features.
15-
- _Fixed_: for any bug fixes.
16-
- _Security_: in case of vulnerabilities.
10+
- _Added_: for new features.
11+
- _Breaking_: for higher visibility of breaking changes
12+
- _Changed_: for changes in existing functionality.
13+
- _Deprecated_: for soon-to-be removed features.
14+
- _Removed_: for now removed features.
15+
- _Fixed_: for any bug fixes.
16+
- _Security_: in case of vulnerabilities.
1717

1818
## [Unreleased]
1919

20-
- _Fixed_: Missing wp-env script and some documentation changes.
20+
- _Fixed_: Check for autoload.php before requiring it.
21+
- _Fixed_: Missing wp-env script and some documentation changes.

plugin.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
define( 'MULTI_BLOCK_STARTER_URL', plugin_dir_url( __FILE__ ) );
2323

2424
// Include Composer's autoload file.
25-
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
26-
25+
if ( file_exists( plugin_dir_path( __FILE__ ) . 'vendor/autoload.php' ) ) {
26+
require_once plugin_dir_path( __FILE__ ) . 'vendor/autoload.php';
27+
} else {
28+
wp_trigger_error( ' Multi Block Starter Plugin: Composer autoload file not found. Please run `composer install` to install the dependencies.', E_USER_ERROR );
29+
return;
30+
}
2731
// Instantiate the classes.
2832
$multi_block_starter_classes = array(
2933
\Multi_Block_Starter\Enqueues::class,

0 commit comments

Comments
 (0)