one can initialize with WP_Error() with construct without any argument
$error= new WP_Error();
and can add as much Error messages with same error code
if($phone_no==''){
$error->add( 'broke', __( "Please enter valid Phone No.", "my_textdomain" ),"tech_error" );
}
if($email==''){
$error->add( 'broke', __( "Please enter valid Email id", "my_textdomain" ),"tech_error" );
}
display Error Message ::
if(isset($error->errors['broke'])){
if ( is_wp_error( $error ) ) {
$error_string = $error->get_error_message();
echo '<div id="message" class="error"><p style=" color:red">' . $error_string . '</p></div>';
}
}