Discussion on Advanced Custom Fields - Component Field Addon


gummiforweb supports this item


This author's response time can be up to 5 business days.

48 comments found.

Please reflect on your Website the newest Version. Thanks!


All things are now updated. Sorry about that.

I had a problem with my ACF repeater field where I make a repeater and then save the repeater that I just made and then ACF/WP deletes what I just did from Wordpress—BUT when you look at theme code pro – the code is still there. I am using ACF 5.6.2 and Wordpress 4.8.2 and this happens in both my Local and Staging. I deactivated ACF Component and now everything works fine. As mentioned here: https://support.advancedcustomfields.com/forums/topic/repeater-problem-disappearing-subfields/#post-53960


Which version of component field are you using? if you are not using version 1.0.13. Can you download and try it again?

Version 1.0.13 fix the acf 5.6.0 update. Let me know if you are still experience issue.

ok downloaded latest updated plugin and it now works—i recommend everyone do this.

Hello, It seems the preview functionality has stopped working for 5.6 and 1.0.13. It was working for 5.5 and 1.0.12. Any thoughts? Thanks, Joe,

Hi, I tested on an older version again, i still can’t recreate the the issue. My steps are:

1) install “acf pro 5.5.14” and “acf component 1.0.12” 2) tested, revision preview works 3) update “acf pro 5.6.4” and “acf component 1.0.13” 3) tested with the same post, preview still works

However, with some extra additional testing, if you are on managed wordpress hosting, some of them turn off the WP_POST_REVISIONS in the config file (for example wpengine). If WP_POST_REVISIONS is turned off, the post metas are not sent to the preview.

Hey, this is it! We turn off post revisions by default, so with it turned on preview works, thanks. I wonder if this is the best way to go about this though. I wouldn’t naturally equate WP_POST_REVISIONS with preview data, especially when WP sends through other data with it turned off, surely they should at worst disable preview functionality if WP_POST_REVISIONS is turned off? Is this an ACF thing or WP thing? Thanks

It’s more of a WP thing. If you have the revision turned off, wp only send the title and content to the preview, the meta fields are all fetch from the “autosave”. But since the revisions is turned off, there’s no “autosave”

I usually set it to a low amount, like 1 or 2. That way, wp will actually do the autosave, and the preview will still work.

define(‘WP_POST_REVISIONS’, 1);

Hi gummiforweb,

- fresh WP install 4.9.1 - acf pro 5.6.7 - Component field 1.0.14 - Custom Post Type UI 1.5.6 - WPML Media - WPML Multilingual CMS - WPML String Translation - WPML Translation Management ( latest versions )

I have a simple gallery field used as component, and this component is used by a field group visible on “product” custom post type.

When I traslate my custom post “product” the images on the gallery field disappears, no way to copy the images from the original post to the translated post ( clicking “overwrite with italian content” )

Others components works as espected, and are overwrited with the original post content

Hi, thx for reporting, i’ll take a look into this as soon as possible. :)


The issue you are having is not caused by the component field. The default gallery field that’s not inside a component field happens the same.

After some debugging and searching, the behaviors is actually intended. Because when you have the WPML Media plugin activated, all media attachment are duplicated. Therefore the ids is no longer correct. This applies to relationship fields as well.

Here’s some filter you’d have to add inside your functions.php if you want to pull the same images from the default language while having the WPML media plugin activated.


First, we check if the current language is the default or not, if it’s the default, then we don’t need to do anything. If it’s not the default, then we apply the ‘wpml_object_id’ filter, which will grab the translated object id.


Hope this helps, Cheers!

(Very sorry for the late reply, I’ve been dealing with some personal stuff.)

Hey, Great plugin! I do have a small issue that I have found.

If I add component fields to a flexible grid when I go to a page in the backend and don’t make any changes whatsoever I am prompted with a message from the browser: Changes that you made may not be saved.

Do you know why this is happening? It only happens when adding components to the grid.

Everything else works great and maybe this really isn’t a big issue but it gets quite annoying that when I save a page it still prompts me.

Thanks in advanced.


May I ask what’s “flexible grid”? Do you mean the Flexible Content Field? I’ve quickly setup a component field inside a flexible content field, and i didn’t experience the same issue you have. So i’m assuming “flexible grid” is something else?

However, if you do mean Flexible Content Field, could you send me a quick export of how the field group is setup? And maybe which browser. Thanks.


Hi gummiforweb, this plugin rocks, only one thing: when you create the “acf-json” folder inside the template folder (where all the fields are saved in indipendent files) would be really useful if the component fields could be stored in a /components subfolder. In this way all would be more readable and maintainable. Thanks!


That’s a neat feature. Unfortunately, after digging around the code base, there’s isn’t a safe hook where i can dynamically change the saving location.

Yes, ACF can load local json fields from multiple directories, but, when it comes to saving and syncing, it only allows one folder. As it pointed out in the doc, “Only 1 save point (folder) exists and can be customized…”


Having said that, there’s sort of an “unethical way” to do it. By hacking into the `acf/update_field_group` just before the acf_json’s write the file and reset it right after. Here’s what the code look like, you can copy and paste it into your theme’s function.php:



how does this functionality compare to ACF new ‘clone’ feature? thanks!


Component Fields are created before the official Clone field released. However, there’s still some differences. I’ve lists out the differences in the previous comment, which can be found here:


Hope that answers your question :)

Hi, some strange bug I found. When using option page, and you created there repeater field and in it inserted some component field. Then if I trying it retrieve through get_field function in functions.php $some_field = get_field(‘some_repeater_field_with_component_field’,’option’); , then in admin acf option page that component field won’t show.

if( function_exists(‘acf_add_local_field_group’) ):

acf_add_local_field_group(array( ‘key’ => ‘group_59d5fcc02e405’, ‘title’ => ‘[component] Text editor’, ‘fields’ => array( array( ‘key’ => ‘field_562cd2992b866’, ‘label’ => ‘Repeater’, ‘name’ => ‘repeater’, ‘type’ => ‘repeater’, ‘instructions’ => ’’, ‘required’ => 0, ‘conditional_logic’ => 0, ‘wrapper’ => array( ‘width’ => ’’, ‘class’ => ’’, ‘id’ => ’’, ), ‘collapsed’ => ’’, ‘min’ => 1, ‘max’ => 12, ‘layout’ => ‘block’, ‘button_label’ => ‘Add Row’, ‘sub_fields’ => array( array( ‘key’ => ‘field_562cd2b22b867’, ‘label’ => ‘Editor’, ‘name’ => ‘editor’, ‘type’ => ‘wysiwyg’, ‘instructions’ => ’’, ‘required’ => 0, ‘conditional_logic’ => 0, ‘wrapper’ => array( ‘width’ => ’’, ‘class’ => ’’, ‘id’ => ’’, ), ‘default_value’ => ’’, ‘tabs’ => ‘all’, ‘toolbar’ => ‘full’, ‘media_upload’ => 1, ‘delay’ => 0, ), ), ), ), ‘location’ => array( array( array( ‘param’ => ‘post_type’, ‘operator’ => ’==’, ‘value’ => ‘post’, ), ), ), ‘menu_order’ => 0, ‘position’ => ‘normal’, ‘style’ => ‘default’, ‘label_placement’ => ‘top’, ‘instruction_placement’ => ‘label’, ‘hide_on_screen’ => ’’, ‘active’ => 0, ‘description’ => ’’, ‘is_acf_component’ => 1, ));


I just tried your code setup, and the fields do show up in the “Global Options” admin option page and the values are saved properly as well.

Which WP version ACF Compponent and ACF PRO version are you having? Mine’s all at latest version.

If you still having trouble after upgrading to the latest version. You can send me a temporarily admin login to your site, or a zip file of your theme and some screenshot of the issue you are having, Then i can take a further look. My email is gummiforweb@gmail.com

Email sended