Advertisement
verygoodplugins

Untitled

Jan 17th, 2019
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1. function remove_array_data( $update_data, $user_id, $contact_id ) {
  2.  
  3.     foreach( $update_data as $key => $value ) {
  4.  
  5.         if( is_array( $value ) ) {
  6.  
  7.             $update_data[ $key ] = implode(', ', $value);
  8.  
  9.         } elseif( strpos( '[', $value ) !== false  ) {
  10.  
  11.             $update_data[ $key ] = str_replace('["', '', $update_data[ $key ]);
  12.             $update_data[ $key ] = str_replace('"]', '', $update_data[ $key ]);
  13.  
  14.         }
  15.  
  16.     }
  17.  
  18.     return $update_data;
  19.  
  20. }
  21.  
  22. add_filter( 'wpf_gform_pre_submission', 'remove_array_data', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement