I am trying to get the authors
user_id on a page linked to by using
John Smith is
23. I need to get
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.Sign up to join this community
On an "author" page
get_query_var('author') will give you the ID.
get_queried_object() will get you considerably more author information.
$author = get_queried_object(); echo $author->ID; // var_dump($author); // to see all of the information available.
For retrieving custom author data follow the Codex.
First extract the nice name of the author from the author url, then you can get the author then you need to query the
wp_users table like bellow.
$nicename = "gowrisankar"; // example global $wpdb; $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM wp_users WHERE user_nicename = %s ",$nicename));