Nice, thanks 😀
Have you found any new solution for this problem of “type” argument?
I’m stuck with the same problem (script work without “type”, script not loaded with “type”).
As jkgk have said it’s not a big matter to leave the type argument but in the same time it would be a pitty not to use it if it’s supposed to be available 😉
And by the way, I’ve turn around the subject on the forum and I suspect that some unanswered topics are related with the same problem.
Thanks for any help!
I think something like that should work:
function my_acf_format_value( $value, $post_id, $field ) {
$value = round($value, 2);
echo $value;
}
// Apply to fields named "my_field_name".
add_filter('acf/format_value/name=my_field_name', 'my_acf_format_value', 10, 3);
The filter “acf/format_value” give the ability to modify the value of a specific field (here by field’s name).
https://www.advancedcustomfields.com/resources/acf-format_value/
Hope this helps 😉
You are welcome 😉
Repeater, Flexible content, Gallery and Clone Fields are the ones that are only available with ACF Pro. Is it one of that kind that you are trying to modify ?
I don’t think so. The main difference between ACF and ACF Pro is the number of fields available, not the functionnality in itself. Even, not showing the ACF Pro menu without licence key would be a nonsens as this would be then impossible to fill the key to activate ACF Pro 😉
I’m not an expert but I would say that there is another code section that hide your ACF menu or maybe a compatibility issue with another plugin.
This could help you: https://support.advancedcustomfields.com/forums/topic/custom-fields-doesnt-appear-in-dashboard-menu/
As explain, you can start to try access the page directly (http://www.yoursite.com/wp-admin/edit.php?post_type=acf) to see if ACF is running. With the website I’m working on, the address is now (http://www.yoursite.com/wp-admin/edit.php?post_type=acf-field-group) so try both to be sure.
If this is working, that’s means ACF is on and you have to understand in code why it’s hidden in the menu. If it’s not working, I would start to disabled all plugin except ACF and see if this is back.
I guess it could be something like this: https://www.advancedcustomfields.com/resources/how-to-hide-acf-menu-from-clients/
😉
Thanks John, you are always so usefull !!
Just for now I started with a simplified version :
function update_fields_value( $post_id ) {
if (get_post_type($post_id) != 'annuaire') {
return;
}
$localisations = get_field('ACF_localisation', $post_id );
if ( $localisations ) {
$first_localisation = $localisations[0];
update_field( 'field_5f0846f3dbd27', $first_localisation['ACF_adresse_ligne_1'], $post_id );
update_field( 'field_5f08542b4627f', $first_localisation['ACF_adresse_ligne_2'], $post_id );
update_field( 'field_5f08544746280', $first_localisation['ACF_code_postale'], $post_id );
update_field( 'field_5f08548f46281', $first_localisation['ACF_localite'], $post_id );
}
$contacts = get_field('ACF_presentation_du_personnel', $post_id );
if ( $contacts ) {
$first_contact = $contacts[0];
if ( $first_contact['ACF_poste_du_contact'] != "" ) {
$contact_details = $first_contact['ACF_prenom_du_contact'] . ' ' . $first_contact['ACF_nom_du_contact'] . ' (' . $first_contact['ACF_poste_du_contact'] . ')';
} else {
$contact_details = $first_contact['ACF_prenom_du_contact'] . ' ' . $first_contact['ACF_nom_du_contact'];
}
update_field( 'field_5f0844ed062f3', $contact_details, $post_id );
}
}
add_action('acf/save_post', 'update_fields_value', 15);
I have just seen 5/6 posts for the above code testing and realise that there are encoding errors. With this solution I will force the customer to at least open, save (to update the fields) and check the new contents.
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.