Shoora
10/3/2018 - 4:28 PM

Add the itemprop, itemscope and itemtype attributes, and the meta tag to the list of allowed tags / attributes

Add the itemprop, itemscope and itemtype attributes, and the meta tag to the list of allowed tags / attributes

<?php
/*
Plugin name: Add microdata stuff to list of allowed tags
*/

function gce_alter_allowed_tags() {
	global $allowedposttags;

	$microdata_atts = array( 'itemprop' => true, 'itemscope' => true, 'itemtype' => true );

	$allowedposttags['div'] += $microdata_atts;
	$allowedposttags['a'] += $microdata_atts;
	$allowedposttags['img'] += $microdata_atts;
	$allowedposttags['span'] += array( 'content' => true) + $microdata_atts;
	$allowedposttags['meta'] = array( 'content' => true ) + $microdata_atts;
	$allowedposttags['time'] = array( 'datetime' => true ) + $microdata_atts;
}

add_action( 'plugins_loaded', 'gce_alter_allowed_tags' );