Saltar navegación

[Resuelto] Set relationship field default value to current post

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

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 4 respuestas, tiene 2 mensajes.

Última actualización por jamesR-13 hace 3 años, 6 meses.

Asistido por: Minesh.

Autor
Mensajes
#2233529

I am displaying a form for a post inside the content template for its parent post. How do I set the default value of the relationship field to be the current (parent) post?

#2233715

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

With your parent relationship field's value attribute what if you pass the value $current and check if that works for you.

For example:

[cred_field field='@employee-post.parent' class='form-control' output='bootstrap' value="$current" select_text='--- not set ---' required='false']

As you can see how the value attribute is populated with $current:

value="$current"
#2234251

My issue is resolved now. Thank you!

#2234319

OK, so that does populate the field, but when the form is submitted, the relationship isn't created between the two posts.

I can give access to the site if you will turn on the private fields, please.

#2234579

My issue is resolved now. Thank you!

Replaced $current with [wpv-post-id] and it is working now.