Tell us what you are trying to do?
I have created a single line repeater custom field that I want to use as a changelog. What I want is update the custom field by adding a new line from php.
Is there any documentation that you are following?
I usually do somehting like this to update a custom field and it works, but in the case of this repeated field it seems that I need to do something different and I could'nt find any documentation on your website regarding that:
$my_post = array(
'ID' =>23,
'wpcf-change-log' => "new text for the changelog",
);
// Update the post into the database
wp_update_post( $my_post );
That is what I want, I uploaded a screenshot just to make sure we are talking about the same thing.
I basically want to add a new entry with php, like doing a click in that "Add new" button" but with php. LoL
I'm currently using:
update_post_meta($post_id, 'wpcf-change-log', 'new text for the changelog');
And it updates the first entry, I'm using this because I need to have something working... but that is not my ideal solution.
I tried your example(with my own variables):
add_post_meta( $post_id , 'wpcf-change-log', "new text for the changelog");
but nothing happens.
Does my screenshot help? or are we talking about the same thing and it's something else in my code what causes the problem.
It should work. Can you please tell me exactly when you would like to add the new value using add_post_meta( $post_id , 'wpcf-change-log', "new text for the changelog");?
Can you please share access details so I can review the things and share the details when exactly you would like to add the new value. Problem URL with an explanation would help.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.