Skip to content

Instantly share code, notes, and snippets.

@RadGH
Created October 1, 2013 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RadGH/6782757 to your computer and use it in GitHub Desktop.
Save RadGH/6782757 to your computer and use it in GitHub Desktop.
Remove sanitization filters from the Options Framework plugin by Devin Price
<?php
// Disable sanitization of specific fields by removing the sanitization filter hooks
// Note that at least one filter must exist for the field to be saved.
function optionsframework_remove_sanitization() {
// Text areas
remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
add_filter( 'of_sanitize_textarea', function ($input) { return $input; });
// TinyMCE Editors
remove_filter( 'of_sanitize_editor', 'of_sanitize_editor' );
add_filter( 'of_sanitize_editor', function ($input) { return $input; });
// Info
remove_filter( 'of_sanitize_info', 'of_sanitize_allowedposttags' );
add_filter( 'of_sanitize_info', function ($input) { return $input; });
// See options-sanitize.php for more filters
}
add_action('admin_init', 'optionsframework_remove_sanitization', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment