Last active
September 23, 2018 18:48
-
-
Save tripflex/db634bb0e9d422a4947770f6525e47f4 to your computer and use it in GitHub Desktop.
Remove sanitation on textarea field type for specific meta key when using WP Job Manager Field Editor (from frontend)
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', function(){ | |
return 'smyles_no_sanitize_textarea_metakey_handler'; | |
}); | |
function smyles_no_sanitize_textarea_metakey_handler( $key, $field ){ | |
$dirty = isset( $_POST[ $key ] ) ? trim( $_POST[ $key ] ) : ''; | |
$clean = isset( $_POST[ $key ] ) ? wp_kses_post( trim( stripslashes( $_POST[ $key ] ) ) ) : ''; | |
// Replace 'some_meta_key' with the meta key you want to allow dirty (unsanitized) value to be saved to listing | |
return $key === 'some_meta_key' ? $dirty : $clean; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to save value without sanitation in admin area use this code:
https://gist.github.com/tripflex/fca9ccda2315ab13bc390f41dcc6ba98