Skip to content

Commit 024932a

Browse files
committed
fix: satisfy tightened wp_register_script types
1 parent 11c3d9b commit 024932a

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

entries/sidebar/index.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,26 @@ function wp_seo_register_sidebar_scripts() {
2222
/**
2323
* Asset file to automatically load dependencies and version.
2424
*
25+
* Dependencies are script handles, which are never empty strings.
26+
*
2527
* @var array{
26-
* dependencies: string[],
28+
* dependencies: non-empty-string[],
2729
* version: string,
2830
* } $asset_file
2931
* */
3032
$asset_file = include __DIR__ . '/index.asset.php';
3133

34+
$src = plugins_url( 'index.js', __FILE__ );
35+
36+
// Nothing to register without a URL to register it from.
37+
if ( '' === $src ) {
38+
return;
39+
}
40+
3241
// Register the sidebar script.
3342
wp_register_script(
3443
'wp-seo-sidebar',
35-
plugins_url( 'index.js', __FILE__ ),
44+
$src,
3645
$asset_file['dependencies'],
3746
$asset_file['version'],
3847
true

0 commit comments

Comments
 (0)