How can I programmatically use the data of the bult-in WordPress functions.
E.g. I’d like to use the data of
the_author_meta('login_name');
in a php function. Problem: The function echoes the value by default. In order to use the actual value in a function I can think of using an output buffer like …
ob_start();
the_author_meta('login_name');
$contents = ob_get_contents();
ob_end_clean();
but I was hoping for a better (less bloated) solution.
Any idea how to get the echo values as simple return values instead?
use
get_the_author_meta()
for return the value.Note: All of wordpress meta methods (the_post,the_author,the_page etc.) are supports the
get_
prefix