Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Conditionally Change Textarea Sanitation in Options Framework Plugin
- * essentially removes sanitization from textarea that was setup with id = "example_textarea"
- * to be placed in your theme's functions.php
- */
- // @ remove the default sanitize filter and replace with our own
- // the key turned out to be passing the second variable $option to the new filter
- add_action('init','kia_remove_sanitize_textarea');
- function kia_remove_sanitize_textarea(){
- remove_filter( 'of_sanitize_textarea', 'of_sanitize_textarea' );
- add_filter( 'of_sanitize_textarea', 'kia_sanitize_textarea', 10, 2 );
- }
- // @ new textarea sanitization filter
- function kia_sanitize_textarea($input, $option){
- // if this option is the one we want to allow all tags on, we return the input unchanged
- if( $option['id'] == "example_textarea" ) {
- // you sure you don't want to sanitize this?
- $output = $input;
- } else {
- global $allowedposttags;
- $output = wp_kses( $input, $allowedposttags);
- }
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement