Profile section is messed up after using a code

After using the code from here on my Wordpress 4.9.7 website I thought initially that everything is fine, it was showing First Name & Last Name First Initial , but then I noticed that my other website functionalities are affect like /profile , clients are unable to change their profile, when click on profile its just refreshing the website while it adds /profile on link, but the most important thing is that I cannot reverse the effect. I have removed the code from child them function.php file with no effect , its still showing showing First Name & Last Name First Initial , and clients are unable to edit their profile anymore. I have downloaded the entire website and searched for the code, its not present. It seems like your code altered the entire database, if I restore an old database backup the problem is gone but the backup its too old, I Need to fix the problem on the actual DB. I have also tried to run the code again by replacing 'hide' with 'show' but it has no effect ! The big problem is that no one is able now to edit their profile, I need solution to resolve that, if not, PLEASE HELP to restore everything as before!

Actually I have used most of the codes on this thread, I'm not sure which one altered the DB but I need the reverse code to fully restore it.

It seems like custom slags set on theme are also affected, they only work the default preset, if change it is saying 404 error page not found. How to fix that now ..? Incredible how much damage the code has done.

Original Code:

add_action( 'admin_init', 'fix_display_name' );
function fix_display_name() {
	$users = get_users();
	foreach( $users as $user ){
		if( $user->first_name != '' && $user->last_name != '' ){
			$display_name = $user->first_name . ' ' . substr( $user->last_name, 0, 1 ) . '.';
			wp_update_user(
				array(
				      'ID' => $user->ID,
				      'display_name' => $display_name
				      )
			);
		}
	}
}

add_action( 'admin_head', 'hide_profile_field' );
function hide_profile_field() {
    ?>
    <script type="text/javascript">
    jQuery(function($) {
        $('.user-nickname-wrap, .user-display-name-wrap').hide();
    });
    </script>
    <?php
}