The action name suggests it is run _after_the_content
, not within the the_content
itself, so you might have to do something different here like @SamuelElh is suggesting…
You would add a function to the action with early priority to buffer, then add a filter to the final output with a late priority:
add_action('tribe_events_single_event_after_the_content','tribe_events_single_event_buffer_start',0);
function tribe_events_single_event_buffer_start() {ob_start();}
add_action('tribe_events_single_event_after_the_content','tribe_events_single_event_buffer_end',999);
function tribe_events_single_event_buffer_end() {
return apply_filters('tribe_events_single_event_filter_output',ob_get_clean());
}
function tribe_events_single_event_filter_output($content) {
$content = preg_replace("/tribe-events-button/i", "tribe-events-button button", $content);
return $content;
}