[Resuelto] Find and change CPT field on form submission
This support ticket is created hace 4 años, 11 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.
I have an edit user form with ID=2328. On the form is a single select option with either 'Yes' or 'No' (asking Do I have children?)
If the user selects 'No' then when the form is submitted I want a hook that performs these tasks:
1. Find all CPT 'People'(that have been created by the current logged in user) where the Field value of these people 'Child' = 'Yes'
2. Replace the field value of 'Child' with 'No' and save
I thank you in advance for your help and time with this..
I have followed your instructions and the code is not working...The only things I changed were I added a ' that was missing after func_update_child_field_values,10,2) and I changed the CPT to 'Person' rather than the plural 'People'...is this the right thing to do?
I've added it to the custom code section but the function won't fire..
Ok - can you please share problem URL where I can see the profile form and admin access details.
Also, please setup a user who already have few people posts with 'Child' field where value set to Yes and send me that user access details as well, so I ca use this user for testing.
*** 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.
Can you please check now. The issue why the code was not fired because the code snippet you added but not activated. I've activated it and adjust the code as required.
I've adjusted the code as given under:
=> enlace oculto