i resolved putting in the array taxonomy ids as strings
i fixed in this way
.....
$id_titoli[] = "$term_id"; // before was $id_titoli[] = $term_id; ===>>> the error was here
.......
$postarr = array(
'post_title' => sanitize_text_field( wp_unslash( $titolo_post ) ),
'post_status' => "publish",
'post_type' => "fight",
);
$post_id = wp_insert_post( $postarr);
.......
update_field(“match_valevole_per_titolo”,$id_titoli,$post_id);
it did not…..
i think i fixed with
update_field(“match_valevole_per_titolo”,serialize($id_titoli),$post_id);
i think is about how data is inserted but not about priority. I create post and i have its ID, then i update field. I think problem is about serialized data and how i have to manage them before insert
if you try to use https://developer.wordpress.org/reference/functions/get_term_meta/ do you have value? no more ideas sorry…
do you still see field on the taxonomy in the backend?
@retroriff just tried and it works for me. How do you call field on taxonomy?
i wrote “you are right, without sync i have same problem”, but i tested code in child functions so before json loaded…. tested on page.php is ok
it’s most like my code just some differences:
1) i set third parameter as 1 (small difference i think)
add_filter('acf/settings/load_json', 'red_template_json_load_point', 1);
add_filter('acf/settings/save_json', 'red_template_json_save_point', 1);
function red_template_json_load_point( $paths ) {
// remove original path (optional)
unset($paths[0]);
// append path
$paths[] = get_template_directory() . '/includes/acf_json';
// return
return $paths;
}
function red_template_json_save_point( $path ) {
// update path
$path = get_template_directory() . '/includes/acf_json';
// return
return $path;
}
2) i use “options” and not “option”. Perhaps this?
$red_tmp_font_h1_font = get_field("h1_red_tmp_font_h1_font","options");
@benjamin74 i have your same situation (using json for options). I have problems with fields not created by ACF (json or not) and i’m fixing them using get_post_meta but i HAVE NOT problems using fields generated by json. How do you call json? Perphaps you call get_field before jsons are loaded?
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.