Skip to content

Commit ba7fea2

Browse files
authored
Merge pull request #4341 from muhitasraf/bugfix/elementor-data-type-check
Fix TypeError in json_decode when template content is an array
2 parents 8cdca21 + 1fb8881 commit ba7fea2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

includes/classes/ElementorUtils.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ public function get_all_widgets_in_all_templates(): array {
102102
if ( ! $template_content ) {
103103
continue;
104104
}
105-
$template_content = json_decode( $template_content, true );
105+
if ( is_string( $template_content ) ) {
106+
$template_content = json_decode( $template_content, true );
107+
}
108+
if ( ! is_array( $template_content ) ) {
109+
continue;
110+
}
106111
$all_widgets = array_merge(
107112
$all_widgets,
108113
$this->recursively_get_inner_widgets( $template_content )

0 commit comments

Comments
 (0)