I am using a plugin that gives me the option to customize a specific sentence through wordpress filter.
This is the orginal code:
add_filter('filter_stamper_text_after_replacing_tags', 'customize_text_to_stamp', 10, 2);
function customize_text_to_stamp ($text_to_stamp, $additional_params)
{
$text_to_stamp .= "Adding this test message to the stamping test";
return $text_to_stamp;
}
I need to insert current-username in the $text_to_stamp, so it returns like:
$text_to_stamp .= "Some text here" . Current-Username. "some text here";
This sentence is only displayed if there is a logged in user, so this verification is not necessary.
I dont know how to get the current username and how to insert it into the sentence.
Can you help me?
2
Answers
Try the below code that will help you.