Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created May 26, 2017 22:37
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 tripflex/12d15b4f2f918f4aff0719cd723433b5 to your computer and use it in GitHub Desktop.
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
<?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