Email


目录

Description

The Email field creates an email input, used for storing email address values.

Screenshots

Creating an Email field.

Creating an Email field within an ACF field group.

The Presentation tab allows you to control how your Email field will appear.

The Presentation tab allows you to control how your Email field will appear.

How the email field appears to content editors.

How the email field appears to content editors. You can see how settings in the Presentation layer control what is displayed to editors.

Settings

Template usage

Display value

This example demonstrates how to display an Email field named “contact_email” within a <h2> tag.

<h2><?php the_field("contact_email"); ?></h2>

However, we don’t recommend outputting any ACF value without any sort of protection or escaping. We’ll cover how to protect the address from spam bots in the section below.

Load value

This example demonstrates how to load the value of an Email field named “contact_email” and use it in a mailto: contact link, where the email is protected from spam bots using the WordPress antispambot() function.

email us at <a href="<?php echo esc_url( 'mailto:' . antispambot( get_field(‘contact_email’ ) ) ); ?>"><?php echo esc_html( antispambot( get_field('contact_email' ) ) ); ?></a>

版本号 #1
由 壳壳虫 创建于 2026-08-29 15:44:03 UTC
由 壳壳虫 更新于 2026-08-29 15:44:03 UTC