Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro

Text and numbers

Email

An email address. Invalid ones are dropped when saving.

When to use it. An email address. It is checked when saved, so a wrong one is dropped instead of stored.

What the editor sees. A single-line box that checks the format.

The Email field on an edit screen
The Email field on an edit screen.
Name in files and code email
ugly_get() gives Text.
Behavior can be required; can share a line with other fields

Settings

Setting What it does Default
Placeholder Gray text shown while the field is empty. (empty)

In your theme

PHP
<?php $email = ugly_get( 'contact_email' ); ?>
<?php if ( $email ) : ?>
	<a href="mailto:<?php echo esc_attr( antispambot( $email ) ); ?>">
		<?php echo esc_html( antispambot( $email ) ); ?>
	</a>
<?php endif; ?>

Good to know

  • An invalid address is dropped when saving, not stored as typed.
  • antispambot() is WordPress' own function to make the address harder for robots to read.