Altering the object $record after when the before_save_form_record does work as expected. I have tried the following different ways of doing it with no luck. I'm about to pull my hair out!! What am I doing wrong?
Method 1 - Simply edit the record
add_plugin_hook('before_save_form_record', 'my_before_save_record');
function my_before_save_record($record) {
$record["tags"] = "Hello,World";
}
Method 2 - Return the edited record
add_plugin_hook('before_save_form_record', 'my_before_save_record');
function my_before_save_record($record) {
$record["tags"] = "Hello,World";
return $record;
}
Method 3 - Attempt to capture record by reference
add_plugin_hook('before_save_form_record', 'my_before_save_record');
function my_before_save_record(&$record) {
$record["tags"] = "Hello,World";
}
What do I need to do to get this to work?
Many Thanks
Stephen