Hi TagDiv team,
I’m currently using the Newspaper theme with TagDiv Composer, and I’d like to implement Schema.org microdata markup (e.g. itemscope, itemtype, itemprop) for services and FAQs on some of my pages for better SEO and structured data compatibility.
To make this work, I’ve extended the allowed HTML attributes using wp_kses_allowed_html inside functions.php as follows:
function allow_microdata_attributes($allowedtags) {
$microdata = [
'itemscope' => true,
'itemtype' => true,
'itemprop' => true,
'itemid' => true,
'itemref' => true
];
foreach ($allowedtags as $tag => &$attributes) {
if (is_array($attributes)) {
$attributes = array_merge($attributes, $microdata);
}
}
return $allowedtags;
}
add_filter('wp_kses_allowed_html', 'allow_microdata_attributes', 10, 2);
However, even after doing this:
the microdata attributes disappear both from the editor view and the rendered frontend HTML;
I’ve confirmed that the functions.php is correctly loaded and applied;
I also verified that the attributes are stripped even when I use the Raw HTML module.
So my question is:
➡️ Is there an internal TagDiv Composer or Newspaper filter that sanitizes or strips these attributes even after kses has been adjusted?
And if so, is there a recommended way to allow inline Schema microdata in Text/Raw HTML blocks?
I’d love to keep this inline for SEO reasons, but if it’s not possible, I can switch to JSON-LD with RankMathSEO plugin.
Thank you in advance for your time and support!
Best regards,
Zoltan
Also, I noticed that in your own functions.php, the WooCommerce breadcrumbs use microdata:
‘wrap_before’ => ‘<div class=”entry-crumbs” itemprop=”breadcrumb”>’,
This suggests that microdata such as itemprop is generally acceptable in the Newspaper theme.
So I’m wondering why manually inserted microdata (e.g. via Raw HTML or Composer blocks) is stripped — even though the theme itself uses them internally.
Hi,
I will try to explain as clearly as possible what can be done:
– if you are using an SEO plugin, disable the schema option in the theme – https://i.imgur.com/eGr3UQF.png
– set your code in functions.php using child theme https://forum.tagdiv.com/the-child-theme-support-tutorial/
– set the code using tagDiv Composer in column text or text with title in text zone https://imgur.com/DSSni9j
I hope it helps you.
I checked done all recommended steps – and still not works.
https://cleanexpert.hu/wp-content/uploads/2025/07/schema-markup-stripped-out-1.jpg
https://cleanexpert.hu/wp-content/uploads/2025/07/schema-markup-stripped-out-2.jpg
https://cleanexpert.hu/wp-content/uploads/2025/07/schema-markup-stripped-out-3.jpg
https://cleanexpert.hu/wp-content/uploads/2025/07/schema-markup-stripped-out-4.jpg
switched off/deactivated rankmath seo plugin – which is helps the schema elsewhere also – still stripped /cleared out the important parts of the schema.org.
only your own breadcrumblist itemprop appears on schema.org validator.
The page in context:
https://cleanexpert.hu/tevekenysegeink-maganszemelyek-reszere/
Why is it removing it — the theme or wp_kses?
Thank you.
Hi,
The theme panel schema should be disabled and used the one from SEO plugin.
Also, I made some tests using your screenhost example and indeed the column text is removing the itemprop, so the HTML code should be set in HTML element like this https://i.imgur.com/EHv4afS.png and the results should be https://i.imgur.com/kbck7jU.png
I hope this will help!
Thank you!