Problem:
The user would like to use the form name instead of the form id in his custom code hooks. This is useful if we export/import forms to other websites as they will get different ids.
Solution:
Toolset forms are saved as posts for an internal custom post type "cred-form". You can use regular WordPress functions to get the name of the form from the id:
$form = get_post( $form_id ); $form_name = $form->post_title;
You can build a function that will return the name of the form from the form_id and use it inside your hooks:
if ( get_form_name( $form_data['id'] ) == 'My Form Name' )
Relevant Documentation:
https://developer.wordpress.org/reference/functions/get_post/
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 |
---|---|---|---|---|---|---|
9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - | - | 9:00 – 13:00 |
14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - | - | 14:00 – 18:00 |
Supporter timezone: Africa/Casablanca (GMT+01:00)
This topic contains 2 replies, has 2 voices.
Last updated by 4 years, 8 months ago.
Assisted by: Jamal.