Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
/**
* Custom sanitization of fields
*/
add_filter('um_profile_field_filter_hook__','my_custom_sanitize_fields', 99, 2 );
function my_custom_sanitize_fields( $value, $data ){
// Add tags to mail value
if ( !is_array( $value ) ) {
if ( is_email( $value ) ){
$value = '<a href="mailto:'. $value.'" title="'.$value.'">'.$value.'</a>';
}
} else {
// implode array values
$value = implode(', ', $value);
}
// Shorten url
if ( $data['validate'] == 'facebook_url' ){
$value = 'https://fb.com/' . $value;
}
return $value;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment