• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / get_user_id_from_string() – Get a numeric user ID from either an email address or a login.

You appear to be a bot. Output may be restricted

Description

Get a numeric user ID from either an email address or a login.

A numeric string is considered to be an existing user ID and is simply returned as such.

Usage

$int = get_user_id_from_string( $string );

Parameters

$string
( string ) required – Either an email address or a login.

Returns

int

Source

File name: wordpress/wp-includes/ms-deprecated.php
Lines:

1 to 14 of 14
function get_user_id_from_string( $string ) {
  _deprecated_function( get_user_id_from_string, '3.6.0', 'get_user_by()' );

  if ( is_email( $string ) )
    $user = get_user_by( 'email', $string );
  elseif ( is_numeric( $string ) )
    return $string;
  else
    $user = get_user_by( 'login', $string );

  if ( $user )
    return $user->ID;
  return 0;
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: get_user_id_from_string
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/ms-deprecated.php
File ref: wp-includes/ms-deprecated.php
Deprecated?: No
API Letters: F,G,I,S,U

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites