Introduction
Developers and website administrators often encounter situations where the Advanced Custom Fields (ACF) or Secure Custom Fields (SCF) shortcode returns empty output when attempting to display field values. This article outlines common causes and solutions for this issue.
Enable the Shortcode
First, verify that the ACF/SCF shortcode feature is enabled. Starting with ACF version 6.3, shortcodes are disabled by default for security reasons. You can check the current status by navigating to: Tools → Site Health → Info → ACF/SCF and locating the Shortcode Enabled parameter.
To enable shortcode support, add the following code to your theme’s functions.php
file:
// Enables ACF/SCF shortcode. add_action( 'acf/init', function () { acf_update_setting( 'enable_shortcode', true ); });
Grant Access
Beginning with ACF 6.3, you must explicitly grant permission for field values to be accessible via shortcodes. Follow these steps:
- Edit your field group
- Select the field you want to display via shortcode
- Click Edit
- Navigate to the Presentation tab
- Enable the Allow Access to Value in Editor UI option
After implementing these changes, the shortcode will properly display the field value instead of returning empty output.
Options Fields
When working with fields from the options page, you must:
- Grant access permissions as described above
- Include the
post_id
attribute with valueoptions
in your shortcode:
[acf field="field_name" post_id="options"]
This instructs the shortcode to look for the field value in the options storage rather than the current post.
Shortcode Override
If you’ve verified all permissions and settings but still experience issues, you can implement a manual shortcode override. Use this solution cautiously as it bypasses built-in security measures.
Add this code to your functions.php
file:
// Rewrites ACF/SCF shortcode. add_shortcode( 'acf', function ( $atts ) { $value = apply_filters( 'acf/format_value', get_field( $atts[ 'field' ], $atts[ 'post_id' ] ) ); return $value; });
Additional Tips
- Clear all caching layers (object cache, page cache, browser cache)
- Verify field values exist in the database
- Check for JavaScript errors in browser console
- Test with default WordPress theme to rule out theme conflicts
- Ensure you’re using the correct field name (case-sensitive)
For persistent issues, consider consulting the official ACF documentation or reaching out to their support team.