Skip to content

Instantly share code, notes, and snippets.

@mojowen
Created June 20, 2012 21:45
Show Gist options
  • Save mojowen/2962427 to your computer and use it in GitHub Desktop.
Save mojowen/2962427 to your computer and use it in GitHub Desktop.
Add Filter for Microsoft Word Style elements
<?php
add_filter('the_content', 'remove_microsoft_word');
function remove_microsoft_word($content) {
$find = strpos($content,"<style type=\"text/css\">
<!--
/* Font Definitions */");
while( $find ) {
$end = strpos($content,"
-->
</style>",$find);
$content = substr($content,$end+14);
$find = strpos($content,"<style type=\"text/css\">
<!--
/* Font Definitions */");
}
return $content;
}
?>
@mojowen
Copy link
Author

mojowen commented Jun 20, 2012

Add to functions.php. Only works well when style elements are at the head of a document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment