Try this code. $author = get_user_by( 'slug', get_query_var( 'author_name' ) ); echo author->ID;