tags:

views:

46

answers:

1

Hello all,

I am trying to loop through authors in my wordpress blog but something weird keeps happening, probably because I haven't fully grasped how to use the functions. When I do this:

$authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);
if($authors):
foreach($authors as $author):
if(the_author_meta('display_name', $author->post_author) != 'admin'): //my line

I am trying to exclude the "admin" user from my loop, but when I execute this. I get the all authors names shown twice on the page including the admin. So the conditional is not acting as a conditional but rather an echo!

What I am doing wrong?

Thanks all

+1  A: 

Use *get_the_author_meta()*, and and not *the_author_meta()*. The one you're using echos results to the browser as part of the function.

cori
Fantastic! Thank you very much Cori. :)
Abs
my pleasure! :)
cori