i'm facing a weird problem.
I have a cutom post type 'cpt_dates' with a taxonomy 'cpt_dates_postIDs'. I need to save as a taxonomy term an ID of another post (from another CPT, freshly inserted with $cpt_dates_post_ID = wp_insert_post
).
The thing is I don't understand why. Because in all websites I've seen they said to use intval()
because the function seems to wait for a numeric number.
... or I missed something
$cpt_dates_post_ID = wp_insert_post( $dates_insert_args, true );
var_dump($cpt_dates_post_ID); // int(68);
WORKS :
wp_add_object_terms( $cpt_dates_post_ID, strval($another_post_id), 'cpt_dates_postID');
WORKS :
wp_add_object_terms( $cpt_dates_post_ID, 'foo', 'cpt_dates_postID');
DOESN'T WORKS :
wp_add_object_terms( $cpt_dates_post_ID, intval($manifestation_insert_id), 'cpt_dates_postID');
Thank you ! Nicolas.