Hi @magazine3,
just to clarify: your recent link to the github issue points to another error while enabling the plugin connected to schema_type.php
.
The post’s author is referencing a PHP warning from php8+ affecting output/function.php
(captured also from my PHP logs as follows):
PHP Warning: Undefined array key "title" in .../schema-and-structured-data-for-wp/output/function.php on line 3408
PHP Warning: Undefined array key "description" in .../schema-and-structured-data-for-wp/output/function.php on line 3410
PHP Warning: Undefined array key "uploadDate" in .../schema-and-structured-data-for-wp/output/function.php on line 3411
PHP Warning: Undefined array key "duration" in .../schema-and-structured-data-for-wp/output/function.php on line 3412
PHP Warning: Undefined array key "viewCount" in .../schema-and-structured-data-for-wp/output/function.php on line 3418
I do not know why some of the array values remain empty, but as a quick fix, I just added a default value.
--- function.org.php 2022-10-11 12:28:42.354689807 +0200
+++ function.php 2022-10-11 12:31:20.730785565 +0200
@@ -3405,17 +3405,17 @@
$input1['itemListElement'][] = array(
'@type' => 'VideoObject',
"position" => $vkey+1,
- 'name' => $v_val['title'],
+ 'name' => $v_val['title'] ?? '',
'url' => $v_val['video_url'],
- 'description' => $v_val['description'],
- 'uploadDate' => $v_val['uploadDate'],
- 'duration' => $v_val['duration'],
+ 'description' => $v_val['description'] ?? '',
+ 'uploadDate' => $v_val['uploadDate'] ?? '',
+ 'duration' => $v_val['duration'] ?? '',
'contentUrl' => $v_val['video_url'],
'embedUrl' => $v_val['video_url'],
'interactionStatistic' => array(
"@type" => "InteractionCounter",
"interactionType" => array("@type" => "WatchAction" ),
- "userInteractionCount" => $v_val['viewCount']
+ "userInteractionCount" => $v_val['viewCount'] ?? ''
),
'thumbnailUrl' => isset($v_val['thumbnail_url'])? $v_val['thumbnail_url'] : saswp_get_thumbnail(),
);
Cheers!
Matthieu