Created
December 6, 2018 12:13
-
-
Save jcasabona/400eb58e8c86dd5dc7bf806b33a687bd to your computer and use it in GitHub Desktop.
WordPress Filter to Clean Google Docs Markup on Post Save
This file contains hidden or 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 | |
add_filter( 'content_save_pre', 'wpp_clean_google_docs' ); | |
function wpp_clean_google_docs( $content ) { | |
if ( ! ( 'transcript' == get_post_type() ) ) { | |
return $content; | |
} | |
$search = array( ' ', | |
'</span>' | |
); | |
$content = str_replace( $search, '', $content ); | |
return preg_replace( '/<span[^>]+\>/i', '', $content ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment