Try this:
chart.dataSource.url = "<?php echo the_field('gas_data_file', 'option'); ?>";
Did you try?
echo get_field(‘text’, $product->get_id());
Are you sure your field name is “text”?
You can see all custom fields on single page using var_dump(get_fields($product->get_id())) and print it out to see if that field exists.
You need to scape the iframe html into a textarea, something like this:
<textarea>
<?php html_special_chars('<iframe></iframe>')?>
</textarea>
Where “<iframe></iframe>” should be the result of your field.
I can confirm “wp is not defined” it´s fixed on ACF 5.9.1.
Thanks!
Having same problem and i ended in the same as kcalv said about acf_form_head();
And for what i could see the problem start since this change on the wp core:
See how it´s added a new “__ = wp.i18n.__;” into the ColorPicker var.
I guess many other changes in core about i18n and how js uses translations are the problem here, sine i saw many other plugins that are having the same not defined “wp”.
For what i see this is a change that affects many other things, all related on how js uses translations, basicly this:
This removes the usage of wp_localize_script()
for passing translations to the script and instead adds the translatable strings in the script directly through the use of wp.i18n
and its utilities.
Hope this help to find the solution.
edede, that´s the reason i ended testing to use anyway WP 5.0.3 but with ACF 5.7.6. I prefer to use last wp model and wait for acf 5.8
The bad is if you use gutemberg, that´s not my case and i disabled it using Classic Editor plugin.
Ok, i decided to make the downgrade acf to 5.7.6 on my localhost, many sites at once, all with wp 5.0.3, and problems went, no js errors, fields saves again, no problem with location rules.. but, no gutemberg enabled off course 🙁
Well, i guess i found something:
– I´ve updated again to WP 5.0.3
– Installed Classic Editor to disable gutemberg
– Installed ACF 5.7.6
Working ok.
If i leave Gutemberg, i have problems with conditional location rules for groups, not working. Ex. i have a group wich location is for pages and using a particular page_template. When i change the page_template selector, no group become visible as should be. No errors on console.
If i update ACF to 5.7.7 i have this js error when ichange the page_template as described above: Uncaught TypeError: Cannot read property ‘showEnable’ of undefined
On: advanced-custom-fields-pro/assets/js/acf-input.min.js?ver=5.7.7
Something like on inspector:
at acf-input.min.js?ver=5.7.7:3
at Array.map (<anonymous>)
at acf.Model.t (acf-input.min.js?ver=5.7.7:3)
So, something related to the location group and how acf detect/process that once the selector triggers “change” or similar.
Also reading comments for the chages into acf 5.7.7 version says:
“Dev – Major improvements to the acf.models.Postbox model.”
Maybe this has something to do with this issue, something with acf.models since that appears to be related to the js error when says acf.Model.t on acf-input.min.js
So in resume, running WP 5.0.3, but without Gutemberg, and with ACF 5.7.6 is the only way i could make things to keep working as before… till now.
Hello again, i´ve downgrade my last fresh install as i mentioned later, so i go down to WP 4.9.9 and all commented errors gone.
So, i think we should wait for acf 3.8.0 to use wp 5.0.x
I did not have time to test with wp5 and acf5.8beta yet.
Guys, more updates:
– I´ve installed wp 5.0.3 and acf 5.7.9 on a fresh install and i notice another issue using just Twenty Nineteen theme, where i added just a custom template (clone page.php) to check the Group Location when some page_template.
I´m having this js error:
Uncaught TypeError: Cannot read property ‘filter’ of undefined on wp-includes/js/dist/vendor/react-dom.min.js?ver=16.6.3
This is when editing a page using a group with just one text field inside. The error cames when switch Page Template, since this group has a Location to be visible only on post_type==page and page_template=my-template.php
The same location also has another rule to be post_type=post && post_category=categoria-test
As follows:
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5c38d943224d3',
'title' => 'Tests on aside posts',
'fields' => array(
array(
'key' => 'field_5c38d946c6704',
'label' => 'text',
'name' => 'text',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => '',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
array(
'param' => 'post_category',
'operator' => '==',
'value' => 'category:categoria-test',
),
),
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'page',
),
array(
'param' => 'page_template',
'operator' => '==',
'value' => '_template-test.php',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
When editing a post_type = post, the error do not happend, only on pages and only when using gutemberg. If i use Classic Editor Plugin to disable gutember, the error do not hapend. But… a big “but”, on another wp site, same versions, the error also hapend when no gutemberg working.
I´ve also tested same thing with a custom post type, and same thing, something when switch something that has a location rule assigned.
Well… return to work 🙂
Something else, even those select fields SAVE on post update, when i leave the page it alert me if i´m sure since there are changes not saved. When i return to the same edit page, changes into the select are ok.
Same thing happens if just click Update without changing anything, alert of loosing changes if leave.
On posts without ACF fields, but using gutemberg (default post), this thing do not happend.
Well, forget about when i said “working ok”…
The first field that was saved is a textfield into a group displayed on pages. This one SAVE on page update using gutemberg.
The second field is a textarea inside a flexible field inside a group. This one NOT SAVE on page update.
If i use another flexible field, with a select, it was SAVED on update page.
Those same flexible fields are used also on a custom post type that do not use gutemberg, on those, fields save normaly. Something when using gutemberg for sure, right?
So… i don´t know, for now i can see something with textareas/text fields on flexible fields not saving with gutemberg.
Anybody can check something like this situation? Test with diferent field types.
Hey guys, some more data:
Yesterday i installed a new site i´ve started to develope, same WP 5.0.2, same ACF 5.7.9, same Parent theme i use for all my projects…. and, when i went to some page (first edited one on fresh install) my custom fields where saved, and in fact is working.
It´s very strange, on the old websites, where i updated WP from 4.9 to 5.0, this thing about gutemberg and saving fields don´t work. But with same versions installs from zero yes they work. JS Cache problems are not the issue for sure.
I was clear? new installs works, updated ones not.
At least that´s my last experience related to this. Hope helps to find what is going on.
Hi Novalis, what you described is exactly my case, same thing. And i´m sure is something related with the acf/save_post… it´s not doing the action when publish posts with gutemberg editor.
As i said, using old Classic editor, works, but for this on WP 5 and up, you need to disable gutemberg.
I´m a little worry about this because i have lot of sites runing wp 4.xxx and i can´t update them.
Hi, nop, i couldn´t solve the problem using WP 5.0. The only way is to install the Classic Editor plugin, so guttemberg editor will be disabled.
When guttemberg is enabled, pages, posts, etc, having custom groups/fields, do not save the changes when pressing “publish”. The new content on those fields do not disappear, but if i leave editor and return, no changes saved.
I guess is something when guttember saves data (js), well, it´s not saving for some reason, thats´s the problem.
Whow, i´m using ACF since the begining of times and i never saw that part of the “field_” for the key values!!! My bad 🙁
Thanks so much John!!!
Hi John, nop, the “key” field is “key__classes__content_row__container”, i named with “key_” my key fields and without “key” the names, so for any field i allways have:
key: key__classes__content_row__container
name: classes__content_row__container
If i apply the filter using the key “key__classes__content_row__container” it apply for any field everywhere, and that´s the thing i don´t want.
I need to apply a filter to that cloned field but just in that place, not all the cloned fields using that field.
This is the final field, that´s a cloned one inside a flexible field:
<input type="text" id="acf-key__flexible_content_rows-5b8d6b7c7ff95-key__layout_html_row__content_key__r_builder_classes_group-key__classes__content_row__container" name="acf[key__flexible_content_rows][5b8d6b7c7ff95][key__layout_html_row__content_key__r_builder_classes_group][key__classes__content_row__container]" value="container" placeholder="container">
And this is the same field but in another flexible layout:
<input type="text" id="acf-key__flexible_content_rows-5b8d6cb87ff96-key__layout_template_row__content_key__r_builder_classes_group-key__classes__content_row__container" name="acf[key__flexible_content_rows][5b8d6cb87ff96][key__layout_template_row__content_key__r_builder_classes_group][key__classes__content_row__container]" value="container" placeholder="container">
The first one is inside “key__layout_html_row__content” (flexible layout)
Second in “key__layout_template_row__content” (flexible layout)
If i apply the filter by key using “key__classes__content_row__container”, it applys for all places but i want to apply only for a particual place, let´s say the first one.
I know it´s very complex my situation….
I guess you are looking for this function get_field_object(), it´s very clear how to use and what you will get: https://www.advancedcustomfields.com/resources/get_field_object/
I guess problem is with get_the_ID on first function since, as wp said “Retrieve the ID of the current item in the WordPress Loop.”, when mixed you get those values from the current loop item. Try changing both, get_the_ID() into get_the_ID($post->ID) and get_the_category() into get_the_category($post->ID) on your first function “get_away_record_update”.
pd: nothing to do, but here is 31 may 2017 and i´m answering a post from the future!!! 🙂
The values returns “Array” because you are probably using “echo” to the returned $field[‘value’], if you first test if the data is an array or a string, you can condition that to make something else and not just an echo for those fields/arrays. Something with if(is_array($field[‘value’])){}else{}… got it?
Are you sure the json has the right values? For example, where is the “key” for each group? i see you are using an “id”, but…. shouldn´t be “key” ?
Also the entire json generated must be inside [] and is not.
Also i notice you are using ‘options’ => array(…. but in my exported json from ACF UI, that thing do not exsits, position, hide_on_screen and so on are “alone” not as part of an array.
So, i think the array that is transformed into json is not well formated and that´s why when importing nothing happens.
Did you test with just a small and simple array let´s say a group with just one text field and no complex location rules?
Related posts i guess means Relationship field, if that´s, then you should take a look what you can do using acf/fields/relationship/query and acf/fields/relationship/result
depending on the event (let´s say ID) you can make some conditional to let the max field value for events field change to 5 and let that +1 you need for that particular participant/event.
I guess….
var_dump($post_object) first of all, i guess you are not getting the args you expected using that code inside that loop.
Yes, i understand, you need to get the values of those fields, not just clone the fields.
May be you could export to php, take the old group with that repeater you cloned. Then include that code in your functions.php but make sure to change field/group keys, must be unique.
On the code you will see a “location” key, you must change that to the new location, let´s say, on some page, or all pages, or a post, you know, where the field group should be placed.
Then using similar functions you already have to build that table from the repeater fields, take the values and use as “defaults” for every field on the repeater you need to.
Once you create a page where this new group is placed, it will get the values from the old repeater as default ones, when saved they will be saved as post meta on database.
Now? 🙂
Sounds good?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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.