Problem:
The user would like to use "cred_filter_field_before_add_to_form " hook to add some logic to a selected form and needs to get the form_id.
Solution:
The form id is part of the form_html_id key from the argument passed to the hooked function. Check this example code that extracts the form id from.
function my_test_cred_hook ( $field ) { $form_html_id = $field['form_html_id']; $form_id = 0; if ( isset($form_html_id) ) { $parts = explode( '_', $form_html_id); $form_id = (int) $parts[2]; } if ( $form_id > 0 ) { error_log( 'form_id ' . $form_id ); } } add_filter('cred_filter_field_before_add_to_form', 'my_test_cred_hook', 10, 1);
Relevant Documentation:
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
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 matthewS-9 4 years ago.
Assisted by: Jamal.