Title: Fix function hooks in wcff-builder.php
Last modified: October 18, 2018

---

# Fix function hooks in wcff-builder.php

 *  [FCatani](https://wordpress.org/support/users/fcatani/)
 * (@fcatani)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/fix-function-hooks-in-wcff-builder-php/)
 * Hi,
 * we’ve noticed that inside `function built_field_wrapper`, there are 2 calls to
   has_action()/do_filter() function instead of has_filter()/apply_filters().
    Could
   you please change this code snippet inside /includes/**wcff-builder.php**:
 *     ```
       ...
       /* CHeck for the custom wrapper action registered */
       if (has_action('wccpf_before_field_rendering') && has_action('wccpf_after_field_rendering')) {
           $before = do_filter('wccpf_before_field_rendering', $_meta);	                $after = do_filter('wccpf_after_field_rendering', $_meta);
           $html = $before . $_html . $after;
       } else {
           /* Special property for URL field alone */
       ...
       ```
   
 * with:
 *     ```
       ...
       /* CHeck for the custom wrapper action registered */
       if (has_filter('wccpf_before_field_rendering') && has_filter('wccpf_after_field_rendering')) {
           $before = apply_filters('wccpf_before_field_rendering', '', $_meta);	                $after = apply_filters('wccpf_after_field_rendering', '', $_meta);
           $html = $before . $_html . $after;
       } else {
           /* Special property for URL field alone */
       ...
       ```
   
 * The do_filter() function is not defined in WP and causes a Execution error, moreover
   it would be nicer to change the logic to the following one:
 *     ```
       if ($_meta["type"] != "url") {
                   	$_html .= '<span class="wccpf-validation-message">' . (isset($_meta["message"]) ? $_meta["message"] : "") . '</span>';
                   }
   
                   /* Special property for URL field alone */
                   $show_label = isset($_meta["show_label"]) ? $_meta["show_label"] : "yes";
                   /* Default field wrapper */
                   $wrapper_class = (isset($_meta["field_class"]) && !empty($_meta["field_class"])) ? $_meta["field_class"] : $_meta["name"];
                   /* Is init field show or hide */
                   $onload_field = (isset($_meta["initial_show"]) && $_meta["initial_show"] == "no" ) ? "display: none;" : "";
                   $html_before = '<table style="'.$onload_field.'" class="wccpf_fields_table ' . apply_filters('wccpf_fields_container_class', '') . ' '. $wrapper_class.'-wrapper">';
                   $html_before .= '<tbody>';
                   $html_before .= '<tr>';
   
                   if ($_meta["type"] != "url" || $show_label == "yes") {
                       $html .= '<td class="wccpf_label"><label for="' . esc_attr($_meta["name"] . $_index) . '">' . esc_html($_meta["label"]) . '' . ((isset($_meta["required"]) && $_meta["required"] == "yes") ? ' <span>*</span>' : '') . '</label></td>';
                   }
                   $html_before .= '<td class="wccpf_value">';
   
                   $html_before = apply_filters('wccpf_before_field_rendering', $html_before, $_meta, $_index);
   
                   $html_after = '</td>';
                   $html_after .= '</tr>';
                   $html_after .= '</tbody>';
                   $html_after .= '</table>';                
   
                   $html_after = apply_filters('wccpf_after_field_rendering', $html_after, $_meta, $_index);
   
                   $html = $html_before . $_html . $html_after;
       ```
   
 * This allows not to replicate the template when applying the filters.
 * Please let us know,
    Thank you
    -  This topic was modified 7 years, 7 months ago by [FCatani](https://wordpress.org/support/users/fcatani/).
    -  This topic was modified 7 years, 7 months ago by [FCatani](https://wordpress.org/support/users/fcatani/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ffix-function-hooks-in-wcff-builder-php%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Thread Starter [FCatani](https://wordpress.org/support/users/fcatani/)
 * (@fcatani)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/fix-function-hooks-in-wcff-builder-php/#post-10810910)
 * Any update on this? Thanks.

Viewing 1 replies (of 1 total)

The topic ‘Fix function hooks in wcff-builder.php’ is closed to new replies.

 * ![](https://ps.w.org/wc-fields-factory/assets/icon-128x128.jpg?rev=2738843)
 * [WC Fields Factory](https://wordpress.org/plugins/wc-fields-factory/)
 * [Support Threads](https://wordpress.org/support/plugin/wc-fields-factory/)
 * [Active Topics](https://wordpress.org/support/plugin/wc-fields-factory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wc-fields-factory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wc-fields-factory/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [FCatani](https://wordpress.org/support/users/fcatani/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/fix-function-hooks-in-wcff-builder-php/#post-10810910)
 * Status: not resolved