This commit is contained in:
Glendel Joubert Fyne Acosta
2021-05-20 09:57:12 -05:00
parent 144bc66cce
commit e6e7f5c0f6
2 changed files with 16 additions and 1 deletions
+15
View File
@@ -292,6 +292,21 @@ if ( ! class_exists( 'um\core\Form' ) ) {
}
/**
* Return the errors as a WordPress Error object
* @return WP_Error
*/
function get_wp_error() {
$wp_error = new \WP_Error();
if ( $this->count_errors() > 0 ) {
foreach ( $this->errors as $key => $value ) {
$wp_error->add( $key, $value );
}
}
return $wp_error;
}
/**
* Declare all fields
*/