cloud WordPress

How to use Advanced Custom Fields on WordPress

intermediate 8 min read Updated 2026-03-18
Quick Answer

Advanced Custom Fields (ACF) allows you to add custom fields to your WordPress posts, pages, and custom post types through an intuitive interface. Install the ACF plugin, create field groups with your desired fields, assign them to specific content types, and display the data using ACF functions in your theme templates.

Prerequisites

  • WordPress admin access
  • Basic understanding of WordPress posts and pages
  • Familiarity with WordPress themes
  • Understanding of PHP basics (optional but helpful)

Step-by-Step Instructions

1

Install and Activate ACF Plugin

Navigate to Plugins > Add New in your WordPress dashboard. Search for Advanced Custom Fields and click Install Now on the official ACF plugin by Elliot Condon. Once installed, click Activate to enable the plugin. You'll see a new Custom Fields menu item appear in your WordPress admin sidebar.
Consider upgrading to ACF Pro for advanced field types like Repeater, Flexible Content, and Gallery fields.
2

Create a New Field Group

Go to Custom Fields > Field Groups and click Add New. Enter a descriptive title for your field group in the Add title field, such as "Product Details" or "Author Information". This title helps you identify the field group later but won't be visible to users.
Use clear, descriptive names for field groups to make them easy to manage as your site grows.
3

Add Fields to Your Group

Click Add Field to create your first custom field. Configure the following settings:
  • Field Label: The display name users will see
  • Field Name: Auto-generated from the label, used in code
  • Field Type: Choose from Text, Textarea, Number, Email, URL, Image, etc.
  • Instructions: Optional help text for users
  • Required: Toggle to make the field mandatory
Repeat this process to add multiple fields to your group.
Keep field names short and descriptive as you'll use them in your template code.
4

Configure Location Rules

Scroll down to the Location section. Set rules to determine where your fields appear by choosing:
  • Post Type: Show on posts, pages, or custom post types
  • Page Template: Display only on specific page templates
  • Post Category: Show on posts in certain categories
  • User Role: Restrict based on user permissions
Click Add rule group to create additional location conditions with OR logic.
Use multiple location rules to show the same fields across different content types without duplicating field groups.
5

Set Field Group Options

In the Settings section, configure:
  • Style: Choose between "Seamless" (no metabox border) or "Standard"
  • Position: Set to "High" to show fields near the top of the edit screen
  • Label Placement: Choose "Top" or "Left" alignment
  • Instruction Placement: Position help text above or below fields
Click Publish to save your field group.
Set position to "High (after title)" for important fields that editors should see immediately.
6

Add Content Using Custom Fields

Edit or create a new post/page that matches your location rules. You'll see your custom fields appear in the editor. Fill in the field values as needed. For image fields, click Select Image to choose from the media library. For text fields, simply enter your content. Save or update the post to store the field data.
Custom field data is saved automatically when you save the post, even if the fields are empty.
7

Display Fields in Your Theme

Add ACF functions to your theme templates to display the field data. Use get_field('field_name') to retrieve values and the_field('field_name') to display them directly:
<?php if( get_field('custom_text') ): ?>
  <p><?php the_field('custom_text'); ?></p>
<?php endif; ?>
For image fields, use:
<?php 
$image = get_field('custom_image');
if( $image ): ?>
  <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>">
<?php endif; ?>
Always check if a field has content before displaying it to avoid empty HTML elements.
8

Test and Refine Your Fields

Create test content to verify your fields work correctly. Check that fields appear in the right locations, display properly on the frontend, and behave as expected. Return to Custom Fields > Field Groups to edit field settings if needed. You can add new fields, modify existing ones, or adjust location rules without losing existing data.
Use the ACF debug mode by adding define('ACF_DEBUG', true); to wp-config.php to troubleshoot field issues.

Common Issues & Troubleshooting

Custom fields not appearing in post editor

Check your Location Rules in the field group settings. Ensure the rules match the post type, template, or category you're editing. Also verify the field group is published, not in draft status.

Fields showing empty values on frontend

Verify you're using the correct field names in your template code. Use get_field('exact_field_name') and ensure the field name matches exactly what's shown in the ACF interface. Check that the post actually has data in those fields.

ACF functions causing fatal errors

Wrap ACF functions in conditional checks: if( function_exists('get_field') ) to prevent errors if the plugin is deactivated. Also ensure you're calling ACF functions within the WordPress loop or with a specific post ID.

Field groups disappeared after theme change

Field groups are stored in the database, not your theme, so they should persist. Check Custom Fields > Field Groups to ensure they're still published. If missing, restore from a backup or check if they were exported as PHP code in your old theme's functions.php file.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official WordPress website before purchasing.