| CARVIEW |
Shortcode
Documentation Functions Shortcode
Overview
Shortcodes can be used within a WYGIWYG to display another field’s value. To learn more about shortcodes, click here.
From ACF 6.3.0, the ACF shortcode is disabled by default for new installs of ACF. If you need to enable it, see enabling the ACF shortcode.
For security, we recommend disabling the ACF shortcode if you are not using it.
Usage
Place the shortcode marker with the desired field within your wysiwyg content. This shortcode runs the same as the the_field() function.
[acf field="field_name" post_id="123"]Example
This is a story about a boy named [acf field="name"]. He is [acf field="age"] years old.Limitations
- Only works for simple text based values
Disabling the Shortcode
The ACF shortcode allows access to any field on any post type as was enabled by default any install of ACF created before the release of ACF 6.3. This means any user who has permission to publish posts on your site can view any ACF data if they know the field name or key. For this reason, we recommend you disable the shortcode if your site is not using it. You can use the following setting to disable it:
add_action( 'acf/init', 'set_acf_settings' );
function set_acf_settings() {
acf_update_setting( 'enable_shortcode', false );
}Enabling the Shortcode
When enabled, the ACF shortcode allows access to any field on any post type. This means any user who has permission to publish posts on your site can view any ACF data if they know the field name or key. For this reason, from ACF 6.3 the shortcode is disabled by default for new installs. If you do need to use it, for example for a page builder, you can use the following setting to enable it:
add_action( 'acf/init', 'set_acf_settings' );
function set_acf_settings() {
acf_update_setting( 'enable_shortcode', true );
}Supercharge Your Website With Premium Features Using ACF PRO
Speed up your workflow and unlock features to better develop websites using ACF Blocks and Options Pages, with the Flexible Content, Repeater, Clone, Gallery Fields & More.
Related
- Features: Updates to ACF Field Functions in 5.11
- Filters: acf/shortcode/prevent_access
- Getting Started: Displaying Values in Your Theme
- Field Types: User
- Functions: acf_form()
On this page
In this category
- acf_add_options_page()
- acf_add_options_sub_page()
- acf_form_head()
- acf_form()
- acf_get_field_groups()
- acf_get_fields()
- acf_inline_text_editing_attrs()
- acf_inline_toolbar_editing_attrs()
- acf_register_block_type()
- acf_register_form()
- acf_set_options_page_capability()
- acf_set_options_page_menu()
- acf_set_options_page_title()
- add_row()
- add_sub_row()
- delete_field()
- delete_row()
- delete_sub_field()
- delete_sub_row()
- get_field_object()
- get_field_objects()
- get_field()
- get_fields()
- get_row_index()
- get_row_layout()
- get_row()
- get_sub_field_object()
- get_sub_field()
- has_sub_field()
- have_rows()
- Shortcode
- the_field()
- the_flexible_field()
- the_repeater_field()
- the_sub_field()
- update_field()
- update_row()
- update_sub_field()
- update_sub_row()
Supercharge Your Website With Premium Features Using ACF PRO
Do more, build bigger, and extend further with features that unlock all the potential of WordPress.
Explore FeaturesSign up for the latest Advanced Custom Fields news, updates, and developer tutorials
Build smarter, faster, better with ACF®
Community
© 2025 WPEngine, Inc. All rights reserved.
1WP Engine is a proud member and supporter of the community of WordPress® users. The WordPress® trademarks are the intellectual property of the WordPress Foundation, and the Woo® and WooCommerce® trademarks are the intellectual property of WooCommerce, Inc. Uses of the WordPress®, Woo®, and WooCommerce® names in this website are for identification purposes only and do not imply an endorsement by WordPress Foundation or WooCommerce, Inc. WP Engine is not endorsed or owned by, or affiliated with, the WordPress Foundation or WooCommerce, Inc.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.