Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Last active December 12, 2024 18:54
Show Gist options
  • Select an option

  • Save yuriinalivaiko/c6d4f651b53f3c37b8591014b7e1e3af to your computer and use it in GitHub Desktop.

Select an option

Save yuriinalivaiko/c6d4f651b53f3c37b8591014b7e1e3af to your computer and use it in GitHub Desktop.
Display all form errors below the form in Ultimate Member.
/**
* Hide error messages under fields.
*/
.um-field .um-field-error {
display: none;
}
<?php
/**
* Display all form errors below the form.
*/
add_action( 'um_after_form', function () {
if ( ! empty( UM()->form()->errors ) ) {
foreach ( UM()->form()->errors as $key => $error_text ) {
echo UM()->fields()->field_error( $error_text, $key );
}
}
} );
@yuriinalivaiko
Copy link
Author

yuriinalivaiko commented Jul 10, 2022

Expected result
example

This gist is a part of the article Display all form errors below the form.

Use this solution if you prefer displaying errors in popup: https://gist.github.com/yuriinalivaiko/3979f4fb19bf42929d1043b257ff5e28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment