kisukedeath

Prevent wordpress html sanitize on post

May 30th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.69 KB | None | 0 0
  1. /*global $allowedposttags;
  2.  $allowedposttags['script'] = array(
  3.      'type' => array(),
  4.      'src' => array()
  5.  );*/
  6.  
  7. //disable WordPress sanitization to allow more than just $allowedtags from /wp-includes/kses.php
  8. //remove_filter('the_content', 'wp_filter_kses');
  9. //add sanitization for WordPress posts
  10. //add_filter( 'the_content', 'wp_filter_post_kses');
  11.  
  12.  
  13. function disable_kses_content() {
  14. remove_filter('content_save_pre', 'wp_filter_post_kses');
  15. }
  16. add_action('init','disable_kses_content',20);
  17.  
  18. // OR
  19.  
  20. // Remove html prevent filtering
  21.    kses_remove_filters();
  22.  
  23. /*function override_mce_options($initArray) {
  24.     $opts = '*[*]';
  25.     $initArray['valid_elements'] = $opts;
  26.     $initArray['extended_valid_elements'] = $opts;
  27.     return $initArray;
  28. }
  29. add_filter('tiny_mce_before_init', 'override_mce_options');
  30. */
  31.  
  32. /*function change_mce_options($initArray) {
  33.  
  34.     $initArray['verify_html'] = false;
  35.     $initArray['cleanup_on_startup'] = false;
  36.     $initArray['cleanup'] = false;
  37.     $initArray['forced_root_block'] = false;
  38.     $initArray['validate_children'] = false;
  39.     $initArray['remove_redundant_brs'] = false;
  40.     $initArray['remove_linebreaks'] = false;
  41.     $initArray['force_p_newlines'] = false;
  42.     $initArray['force_br_newlines'] = false;
  43.     $initArray['fix_table_elements'] = false;
  44.  
  45.     $initArray['entities'] = '*[*]';
  46.  
  47.     return $initArray;
  48. }
  49.  
  50. add_filter('tiny_mce_before_init', 'change_mce_options');*/
  51.  
  52. /*function allow_data_event_content() {
  53. global $allowedposttags, $allowedtags;
  54. $newattribute = "data-event";
  55.  
  56. $allowedposttags["a"][$newattribute] = true;
  57. $allowedtags["a"][$newattribute] = true;
  58. }
  59. add_action( 'init', 'allow_data_event_content' );*/
Add Comment
Please, Sign In to add comment