Last active
November 17, 2023 09:52
-
-
Save tylerforret/d383b9af6b43e64293ad9d582ece475b to your computer and use it in GitHub Desktop.
Allow <span> Tags in Wordpress Post/Page Editor
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 | |
/*Allow Span tags in editor*/ | |
function myextensionTinyMCE($init) { | |
// Command separated string of extended elements | |
$ext = 'span[id|name|class|style]'; | |
// Add to extended_valid_elements if it alreay exists | |
if ( isset( $init['extended_valid_elements'] ) ) { | |
$init['extended_valid_elements'] .= ',' . $ext; | |
} else { | |
$init['extended_valid_elements'] = $ext; | |
} | |
// Super important: return $init! | |
return $init; | |
} | |
add_filter('tiny_mce_before_init', 'myextensionTinyMCE' ); | |
?> |
MVP <3
Thanks, already good in 2023 november :) you saved my day
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you Tyler!