Skip to content

Instantly share code, notes, and snippets.

@evrpress
Last active Feb 27, 2017
Embed
What would you like to do?
Populates the last name if present in the first name field
add_filter( 'mailster_verify_subscriber', function( $entry ) {
if ( isset( $entry['firstname'] ) ) {
$names = explode( ' ', $entry['firstname'] );
$entry['firstname'] = array_shift( $names );
if ( ! empty( $names ) ) {
$entry['lastname'] = implode( ' ', $names );
}
}
return $entry;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment