<?php if ( !defined( 'ABSPATH' ) ) exit;//PHPの宣言と直接アクセスの拒否

/* https://nendeb.com/549 */
function haup_registration_errors( $errors, $sanitized_user_login ){
 
	if ( strlen( $sanitized_user_login ) < 6 ){
		$errors->add('user_name',  __( 'Username must be at least 6 characters.','hima-art-utility' ) );
	}

	return $errors;
}
add_filter( 'registration_errors', 'haup_registration_errors', 10, 2 );
 
/* ユーザー名の文字数の制限を6文字以上にする。(管理画面用) */
function haup_user_profile_update_errors( $errors, $update, $user ){
 
	if ( strlen( $user->user_login ) < 6 ){
		$errors->add('user_name',  __( 'Username must be at least 6 characters.','hima-art-utility' ) );
	}
}
add_filter( 'user_profile_update_errors', 'haup_user_profile_update_errors', 10, 3 );