Need to replace appointment time with morning and afternoon labels

I tried using this code. The code works for normal strings (if I just put it in the post copy) but it doesn’t seem to work with the strings in Appointment Plus. Ideas?

// Replace Appointment Times with Morning or Afternoon

function replace_content($content)


$content = str_replace(‘9:00 am’, ‘Morning Appointment’,$content);

$content = str_replace(‘1:00 pm’, ‘Afternoon Appointment’,$content);

return $content;