diff --git a/includes/Shortcode/Embed_Shortcode.php b/includes/Shortcode/Embed_Shortcode.php index 06a9b7c7d790..1d4abafddde4 100644 --- a/includes/Shortcode/Embed_Shortcode.php +++ b/includes/Shortcode/Embed_Shortcode.php @@ -53,11 +53,16 @@ public function register(): void { * * @since 1.1.0 * - * @param array $attributes Shortcode attributes. - * @param string $content Shortcode content. + * @param array|string $attributes Shortcode attributes. + * @param string $content Shortcode content. * @return string Rendered Shortcode */ - public function render_shortcode( array $attributes, string $content ): string { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + public function render_shortcode( $attributes, string $content ): string { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + // Initialize '$attrs' when not an array OR is an empty string. + if ( empty( $attributes ) || ! \is_array( $attributes ) ) { + $attributes = []; + } + $attributes = shortcode_atts( $this->default_attrs(), $attributes, self::SHORTCODE_NAME ); $attributes['class'] = 'wp-shortcode-web-stories-embed';