Split text value from Cookies into multiple fields

By: Jeremy Alexander | Asked: 01/23/2023
ForumsCategory: Paid Help WantedSplit text value from Cookies into multiple fields
Jeremy Alexander asked 1 year ago

Hello!  I have been able to map cookie fields into a field on a form with the code: 


add_filter('frm_get_default_value', 'my_custom_default_value', 10, 2);

function my_custom_default_value($new_value, $field){   

if($field->id == 569){ //change to the ID of the field     $new_value = ($_COOKIE['UTMSession']);  /


return $new_value;  }


Which returns as one string: utm_source=XXXX&utm_content=XXXX&utm_campaign=XXXX&utm_term=XXXX&utm_medium=XXXX  


I would like some help with splitting the above into multiple values, or just one value I can map to the individual fields for: 

  1. utm_source
  2. utm_content
  3. utm_campaign
  4. utm_term
  5. utm_medium


Let me know if this is something you could help with and at what cost, thanks! 

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community