WordPress: save output of do_action in variable
ob_start(); // start capturing output.
do_action('any_action_you_want');
$save_output_here = ob_get_contents(); // the actions output will now be stored in the variable as a string!
ob_end_clean(); // never forget this or you will keep capturing output.