Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
/** * Use user_login as fallback when email is empty or invalid. * * @since 1.0.0 * * @param string $email_address The email address. * @param int $user_id The user ID. * @return string The email address to use. */ function wpf_use_username_as_email_fallback( $email_address, $user_id ) { // If email is empty or invalid, try to use username instead if ( empty( $email_address ) || ! is_email( $email_address ) ) { $user = get_user_by( 'id', $user_id ); if ( $user && ! empty( $user->user_login ) ) { // Only use user_login if it looks like an email address if ( is_email( $user->user_login ) ) { return $user->user_login; } } } return $email_address; } add_filter( 'wpf_get_contact_id_email', 'wpf_use_username_as_email_fallback', 10, 2 );
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)