Created
May 7, 2015 00:05
-
-
Save uxjw/b812fd9c169eec94719b to your computer and use it in GitHub Desktop.
Prevent TinyMCE from stripping schema.org Metadata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Prevent TinyMCE from stripping out schema.org metadata | |
function schema_TinyMCE_init($in) | |
{ | |
/** | |
* Edit extended_valid_elements as needed. For syntax, see | |
* http://www.tinymce.com/wiki.php/Configuration:valid_elements | |
* | |
* NOTE: Adding an element to extended_valid_elements will cause TinyMCE to ignore | |
* default attributes for that element. | |
* Eg. a[title] would remove href unless included in new rule: a[title|href] | |
*/ | |
if(!empty($in['extended_valid_elements'])) | |
$in['extended_valid_elements'] .= ','; | |
$in['extended_valid_elements'] .= '@[id|class|style|title|itemscope|itemtype|itemprop|datetime|rel],div,dl,ul,dt,dd,li,span,a|rev|charset|href|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur]'; | |
return $in; | |
} | |
add_filter('tiny_mce_before_init', 'schema_TinyMCE_init' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally posted at https://snipt.net/jamesw/prevent-tinymce-from-stripping-schemaorg-attributes-in-wordpress/