Skip Navigation

[Resuelto] Editing CPT

This support ticket is created hace 5 años, 9 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Este tema contiene 7 respuestas, tiene 2 mensajes.

Última actualización por geoffD hace 5 años, 9 meses.

Asistido por: Beda.

Autor
Mensajes
#1203447

Hi

I have a layout to display a CPT 'User Will'. On the layout I have an edit form to edit the current User Will record. The form displays the existing post data to be edited but when submitted rather than editing the existing record it creates a new one...

Please help

Best wishes

Geoff

#1203741

Likely you have either the form set to create new posts instead of "edit posts", or you have some custom code in place that makes this happen.

Can you try this:
- ensure your form is editing posts
- check if it happens with no other plugin and another theme like Twenty Nineteen?

#1203762
Screen Shot 2019-02-21 at 11.40.42.png
Screen Shot 2019-02-21 at 11.40.13.png

Hi Beda

My form is set to 'Edit existing content'.. I have attached a screenshot to show you...and also the start of the form...

The form is embedded in the 'User Will' Template. It finds the saved record and inserts it into the CRED form fields but when the content of the form is edited and submit is pressed it creates a new User Will

#1204046

Hi Beda

For reference I have tried to use the form on a new page and it works perfectly and edits the post required...so I'm guessing it is something to do with the fact the edit form is on the same page as the display post template...i.e. the post is displaying as well as editing...

I can use a workaround of it being on a separate page but it's not ideal and means the user will need to create more clicks to get through the forms

Best wishes

Geoff

#1204463

I am not sure to understand.

Forms to edit posts are usually inserted to the post edited, not to a page.
If they are inserted to a page then you need to pass the ID of the Post they need to edit.

Of course, I tried both locally and it works fine.
I now also tried with the particular settings you show, and that works as well.

It would be very surprising when an EDIT form suddenly starts to CREATE posts

I rather assume there is an issue with this form (corrupted) or the post you edit.
Can you try to just recreate the form (maybe clone it) to see if that solves the issue?

#1204550

Hi Beda

I have tried creating a new form and the problem persists.. I need a quick fix for this so I think I will have to go for having the edit form on a new page and insert the post ID...

I know you're busy at the minute and I can't really keep waiting 20 hours between messages...

Thank you anyway

Best wishes
Geoff

#1204935

Can you send me a copy of that site so I can have a look?
A form cannot create posts if it's set to edit them, it's impossible, there are 2 major functions that determine what the form does, and unless that setting (about what the form does) is corrupted, a Create form can't edit (there will be an error message instead) and the opposite as well - an edit form cannot create posts.

If you can send me a copy of that site, I can deploy it locally, see what is wrong, and suggest a fix.
I can try online however I will not be able to do much more than confirming the issue, I will not be able to debug it there (also because it might break your site)

Here is a link that explains how you could send me a copy of the site:
https://toolset.com/faq/provide-supporters-copy-site/

I am happy to have a look at this immediately and try to fix it.

#1205148

My issue is resolved now. Thank you!