Skip to content

Instantly share code, notes, and snippets.

@yuriinalivaiko
Created November 4, 2022 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuriinalivaiko/babc0fdf4ff1ed7bbdbbfdb677468af0 to your computer and use it in GitHub Desktop.
Save yuriinalivaiko/babc0fdf4ff1ed7bbdbbfdb677468af0 to your computer and use it in GitHub Desktop.
Hook um_{$type}_form_show_field
<?php
/**
* Hook: um_{$type}_form_show_field
*
* Type: filter
*
* Description: Change field HTML by field $type.
*
* @example https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/class-fields.php#L4490
* @link https://docs.ultimatemember.com/article/1323-umtypeformshowfield
*
* @package um\core
* @see um\core\Fields::view_field()
* @since 2.0
* @version 3.0
*
* @param string $output Field HTML.
* @param string $mode Form mode.
*
* @return string Field HTML.
*/
function my_type_form_show_field( $output, $mode ) {
if ( 'login' === $mode ) {
// your code here.
}
return $output;
}
$type = 'text';
add_filter( "um_{$type}_form_show_field", 'my_type_form_show_field', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment