Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Borrar etiquetas HTML del texto pegado en el editor
function wp_clean_on_paste( $in ) {
$in['paste_preprocess'] = "function( plugin, args ) {
var whitelist = 'a,p,span,b,strong,i,em,h3,h4,h5,h6,ul,li,ol';
var stripped = jQuery('<div>' + args.content + '</div>');
var els = stripped.find('*').not(whitelist);
for (var i = els.length - 1; i >= 0; i--) {
var e = els[i];
args.content = stripped.html();
return $in;
add_filter( 'tiny_mce_before_init', 'wp_clean_on_paste' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.