Skip to content

Instantly share code, notes, and snippets.

@milosh-96
Created November 22, 2024 16:19
Show Gist options
  • Select an option

  • Save milosh-96/dbfd2c342e25ac697b82e33c2380755b to your computer and use it in GitHub Desktop.

Select an option

Save milosh-96/dbfd2c342e25ac697b82e33c2380755b to your computer and use it in GitHub Desktop.
Allow more tags in Sanitizer (WP KSES)
<?php
/*
Plugin Name: Allow more tags in Sanitizer (WP KSES)
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is plugin adds more tags Sanitizer so they are not stripped. This is useful if some plugins use styling via style tag and then pass that code via sanitizer.
Author: Milos
Version: 1.0.0
Author URI:
*/
function prefix_filter_allowed_html( $allowedposttags, $context ) {
if($context == 'post') {
$allowedposttags['style']['type'] = true;
return $allowedposttags;
}
}
add_filter( 'wp_kses_allowed_html', 'prefix_filter_allowed_html', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment