How to remove sanitize from edit_user_profile
action?
I have a possibility to change user_nicename with the following code:
function ex_insert_nicename_input( $user ) {
$content = ob_get_clean();
// Find the proper class, try to be future proof
$regex = '/<tr(.*)class="(.*)\buser-user-login-wrap\b(.*)"(.*)>([\s\S]*?)<\/tr>/';
// HTML code of the table row
$nicename_row = sprintf(
'<tr class="user-user-nicename-wrap"><th><label for="user_nicename">%1$s</label></th><td><input type="text" name="user_nicename" id="user_nicename" value="%2$s" class="regular-text" />' . "\n" . '<span class="description">%3$s</span></td></tr>',
esc_html__( 'Name' ),
esc_attr( $user->user_nicename ),
esc_html__( 'Unique' )
);
// Insert the row in the content
echo preg_replace( $regex, '\0' . $nicename_row, $content );
}
add_action( 'show_user_profile', 'ex_insert_nicename_input' );
add_action( 'edit_user_profile', 'ex_insert_nicename_input' );
If I enter "Ab" and updeate user info it will save it as "ab". Is it possible to filter this process and sanitize text, but without transform letters from uppercase to lowercase?
The only thing I need to do is to remove or change this line $user_nicename = sanitize_title( $user_nicename );
in user.php
. But I don't know how to do it correct, without changind core files...