Created
May 26, 2017 22:37
-
-
Save tripflex/12d15b4f2f918f4aff0719cd723433b5 to your computer and use it in GitHub Desktop.
WP Job Manager Field Editor - strip all HTML from textarea field type for specific meta key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'job_manager_get_posted_textarea_field', 'smyles_return_textarea_handler' ); | |
function smyles_return_textarea_handler( $handler ){ | |
return 'smyles_get_textarea_handler'; | |
} | |
function smyles_get_textarea_handler( $key, $field ){ | |
// This is default WP Job Manager handling/sanitization | |
$value = isset( $_POST[ $key ] ) ? wp_kses_post( trim( stripslashes( $_POST[ $key ] ) ) ) : ''; | |
// In this example we target the `job_description` field (must be set to textarea in field config) | |
if( $key === 'job_description' ){ | |
$value = wp_strip_all_tags( $value ); | |
} | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment