Hi @manu_baje
This is likely because different field types will return different data types from the get_field() API call.
Please debug the output to check the returned data: https://www.advancedcustomfields.com/resources/debug/
Is it possible that you have enabled the local JSON feature on your site?
When enabled this feature will load field groups from JSON files on your theme and not from the database.
Please take a look at this page for more info: https://www.advancedcustomfields.com/resources/local-json/
Hi @lsterling03
ACF creates field references on the database once the value has been saved and these do not exist since the data was imported to your db.
I would suggest that you pass the value of the affected field to the update_field() function as described on this page: https://www.advancedcustomfields.com/resources/update_field/
Yes this is possible, you can create an options page to hold different sets of data for each page and since this data is global you can easily display this data conditionally on the footer of each page.
Please take a look at these resources for more info on this:
https://www.advancedcustomfields.com/resources/options-page/
https://www.advancedcustomfields.com/resources/get-values-from-an-options-page/
I hope this info helps. Thank you.
Kindly share a copy of the code that you have so far so that we can be in a position to help.
Thanks.
Yes this is possible, you can create a field group with a set of fields that you want to assign to attachments and then map them using the location rule:
Attachment == Images
Hi @italoborges
This feature works as expected on my end.
Could you please install the Classic Editor plugin and check if there will be different results: https://wordpress.org/plugins/classic-editor/
Your code maybe resetting the global $post object, please make use of a custom foreach loop as shown in this example:
$post_objects = get_field('post_objects');
if( $post_objects ): ?>
<ul>
<?php foreach( $post_objects as $post_object): ?>
<li>
<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
<span>Post Object Custom Field: <?php the_field('field_name', $post_object->ID); ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php endif;
Hi @tpodgro
Is it possible that you are calling this code outside the posts() loop?
If so, you will need to assign a post id as the second parameter on the have_rows() function like so:
$post_id = '123';
if( have_rows('elementalaune',$post_id) ):
while ( have_rows('elementalaune',$post_id) ) : the_row();
get_sub_field('image');
get_sub_field('texte');
endwhile;
else :
echo "Nothing here";
endif;
Hi @dacosta
Would you mind letting us know the versions of WP and ACF that you are currently running?
A copy of the errors reported would also really help.
Hi @iker3085
The following APIs are required for all the map functionality to work:
Hi @benbelek
I cannot seem to reproduce this issue on my end. Please check for conflicts by deactivating all other installed plugins and switching to one of the stock WP themes. You can also use this plugin for troubleshooting: https://wordpress.org/plugins/health-check/
Hi @dwsww
Perhaps you could create a readonly field on each field group and use this to save a unique class name that you can use to target the field group on your page template.
I am thinking that creating a custom field type would be the most ideal approach on this one.
You can check out the starter-kit on this page: https://www.advancedcustomfields.com/resources/creating-a-new-field-type/
I hope this info helps.
Hi @iker3085
I do not think that these charges would be costly when you only use the map on the backend. Here is their pricing table:
SKU $200 monthly credit Equivalent free usage Monthly volume range (Price per thousand)
Static Maps Up to 100,000 loads $2.00
Dynamic Maps Up to 28,000 loads $7.00
I believe that the plugin author also has some plans of introducing open source maps on a future update where you will be able to select the type of map that you want to use.
Hi @vgledhill
You can make use casting to explicitly declare a saved value into the type that you desire.
Here is an example:
<?php
//code goes in functions.php file
function my_acf_format_value( $value, $post_id, $field ) {
// cast the value returned by all text field into integers
$value = (int)$value;
// return
return $value;
}
add_filter('acf/format_value/type=text', 'my_acf_format_value', 10, 3);
?>
I hope this info helps.
Hi @william.alexander
Were you able to figure out the email saving issue as well?
If not, kindly share your updated code so that we can advise further.
Hi there,
You can hook into the acf/save_post hook that is called when the form is submitted and create this logic.
Please take a look at the examples on this page: https://www.advancedcustomfields.com/resources/acf-save_post/
I hope this info helps.
Hi @vgledhill
The text field will save its values as strings.
For the case of the number field, you can get the raw database value by assigning a false parameter to the get_field() like so:
$value = get_field('fieldname',false,false);
You can also use casting within the acf/format_value to ensure that the values are loaded in a particular format: https://www.advancedcustomfields.com/resources/acf-format_value/
Hi @elhussini
To get the number or rows of approved entries on your repeater, you can make use of the following code:
$rows = get_field('repeater_field_name', 'user_'.{user_id}); // get all the rows
$number_of_user_rows = count($rows);
I hope this info helps. Thank you.
Hi @mikey2004
In this case, you can grab individual field values from the $_POST data like so:
$field_value_1 = $_POST['acf']['field_xxxxxxxxxxx'];
In this example, we are making use of field key to target a certain field and you can then add a new row of data to an existing repeater by making use of the following function: https://www.advancedcustomfields.com/resources/add_row/
I recommend using field keys in the above function since this allows ACF to correctly find the field if no existing value has been saved.
Thank you.
Hi @city17
Thanks for the question.
You can learn about using query vars from this article I found on the internet https://zeropointdevelopment.com/how-to-use-url-parameters-to-pass-data-to-wordpress/
Let me know if you need additional help. Thank you.
Hi there,
Thanks for sharing these findings.
It is likely that you are calling the get_field() function before ACF is loaded. You can workaround this by making use of get_post_meta() native function to achieve the same result.
https://developer.wordpress.org/reference/functions/get_post_meta/
I hope this info helps.
Hi there,
Thanks for getting in touch!
You can workaround this issue by creating a custom foreach loop to step through all the gallery images and pass the field value to the update_field() function. The first parameter should be the field key as described on the following page: https://www.advancedcustomfields.com/resources/update_field/
I hope this info helps. Thank you.
Hello there,
Thanks for getting in touch!
You can assign a particular post id to the form through the ‘post_id’ parameter like so:
<?php acf_form(array(
'post_id' => 123,
'post_title' => false,
'submit_value' => 'Update the post!'
)); ?>
I hope this info helps. Thank you.
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.