[Resuelto] I want to update a repeater custom field using php
This support ticket is created hace 4 años, 10 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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.