// Remove Divi placeholder image schema
add_filter('et_builder_render_layout', function($content) {
// Remove itemscope/itemtype/itemprop from placeholder SVGs
$content = preg_replace(
'/]*data:image\/svg\+xml[^>]*)(itemscope|itemtype|itemprop)([^>]*)>/i',
'
',
$content
);
return $content;
}, 999);
// Remove Divi's automatic ImageObject schema for placeholders
add_filter('wpseo_json_ld_output', function($data) {
if (isset($data['@graph'])) {
foreach ($data['@graph'] as $key => $item) {
if (isset($item['@type']) && $item['@type'] === 'ImageObject') {
if (isset($item['contentUrl']) && strpos($item['contentUrl'], 'data:image/svg+xml') !== false) {
unset($data['@graph'][$key]);
}
}
}
// Re-index array
$data['@graph'] = array_values($data['@graph']);
}
return $data;
}, 999);