get_the_author_meta

The timeline below displays how wordpress function get_the_author_meta has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Retrieves the requested data of the author of the current post.
 *
 * Valid values for the `$field` parameter include:
 *
 * - admin_color
 * - aim
 * - comment_shortcuts
 * - description
 * - display_name
 * - first_name
 * - ID
 * - jabber
 * - last_name
 * - nickname
 * - plugins_last_view
 * - plugins_per_page
 * - rich_editing
 * - syntax_highlighting
 * - user_activation_key
 * - user_description
 * - user_email
 * - user_firstname
 * - user_lastname
 * - user_level
 * - user_login
 * - user_nicename
 * - user_pass
 * - user_registered
 * - user_status
 * - user_url
 * - yim
 *
 * @since 2.8.0
 *
 * @global WP_User $authordata The current author's data.
 *
 * @param string    $field   Optional. The user field to retrieve. Default empty.
 * @param int|false $user_id Optional. User ID. Defaults to the current post author.
 * @return string The author's field from the current author's DB object, otherwise an empty string.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'), true)) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string    $value            The value of the metadata.
     * @param int       $user_id          The user ID for the value.
     * @param int|false $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
}

WordPress Version: 5.5

/**
 * Retrieves the requested data of the author of the current post.
 *
 * Valid values for the `$field` parameter include:
 *
 * - admin_color
 * - aim
 * - comment_shortcuts
 * - description
 * - display_name
 * - first_name
 * - ID
 * - jabber
 * - last_name
 * - nickname
 * - plugins_last_view
 * - plugins_per_page
 * - rich_editing
 * - syntax_highlighting
 * - user_activation_key
 * - user_description
 * - user_email
 * - user_firstname
 * - user_lastname
 * - user_level
 * - user_login
 * - user_nicename
 * - user_pass
 * - user_registered
 * - user_status
 * - user_url
 * - yim
 *
 * @since 2.8.0
 *
 * @global WP_User $authordata The current author's data.
 *
 * @param string    $field   Optional. The user field to retrieve. Default empty.
 * @param int|false $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object, otherwise an empty string.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'), true)) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string    $value            The value of the metadata.
     * @param int       $user_id          The user ID for the value.
     * @param int|false $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
}

WordPress Version: 5.2

/**
 * Retrieves the requested data of the author of the current post.
 *
 * Valid values for the `$field` parameter include:
 *
 * - admin_color
 * - aim
 * - comment_shortcuts
 * - description
 * - display_name
 * - first_name
 * - ID
 * - jabber
 * - last_name
 * - nickname
 * - plugins_last_view
 * - plugins_per_page
 * - rich_editing
 * - syntax_highlighting
 * - user_activation_key
 * - user_description
 * - user_email
 * - user_firstname
 * - user_lastname
 * - user_level
 * - user_login
 * - user_nicename
 * - user_pass
 * - user_registered
 * - user_status
 * - user_url
 * - yim
 *
 * @since 2.8.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @param string    $field   Optional. The user field to retrieve. Default empty.
 * @param int|false $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object, otherwise an empty string.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string    $value            The value of the metadata.
     * @param int       $user_id          The user ID for the value.
     * @param int|false $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
}

WordPress Version: 4.9

/**
 * Retrieves the requested data of the author of the current post.
 *
 * Valid values for the `$field` parameter include:
 *
 * - admin_color
 * - aim
 * - comment_shortcuts
 * - description
 * - display_name
 * - first_name
 * - ID
 * - jabber
 * - last_name
 * - nickname
 * - plugins_last_view
 * - plugins_per_page
 * - rich_editing
 * - syntax_highlighting
 * - user_activation_key
 * - user_description
 * - user_email
 * - user_firstname
 * - user_lastname
 * - user_level
 * - user_login
 * - user_nicename
 * - user_pass
 * - user_registered
 * - user_status
 * - user_url
 * - yim
 *
 * @since 2.8.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @param string $field   Optional. The user field to retrieve. Default empty.
 * @param int    $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object, otherwise an empty string.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string   $value            The value of the metadata.
     * @param int      $user_id          The user ID for the value.
     * @param int|bool $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
}

WordPress Version: 4.8

/**
 * Retrieve the requested data of the author of the current post.
 * @link https://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string   $value            The value of the metadata.
     * @param int      $user_id          The user ID for the value.
     * @param int|bool $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
}

WordPress Version: 4.6

/**
 * Retrieve the requested data of the author of the current post.
 * @link https://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filters the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string   $value            The value of the metadata.
     * @param int      $user_id          The user ID for the value.
     * @param int|bool $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters('get_the_author_' . $field, $value, $user_id, $original_user_id);
}

WordPress Version: 4.3

/**
 * Retrieve the requested data of the author of the current post.
 * @link https://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 *
 * @global object $authordata The current author's DB object.
 *
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    $original_user_id = $user_id;
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filter the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     * @since 4.3.0 The `$original_user_id` parameter was added.
     *
     * @param string   $value            The value of the metadata.
     * @param int      $user_id          The user ID for the value.
     * @param int|bool $original_user_id The original user ID, as passed to the function.
     */
    return apply_filters('get_the_author_' . $field, $value, $user_id, $original_user_id);
}

WordPress Version: 4.2

/**
 * Retrieve the requested data of the author of the current post.
 * @link https://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filter the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     *
     * @param string $value   The value of the metadata.
     * @param int    $user_id The user ID.
     */
    return apply_filters('get_the_author_' . $field, $value, $user_id);
}

WordPress Version: 4.1

/**
 * Retrieve the requested data of the author of the current post.
 * @link http://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filter the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     *
     * @param string $value   The value of the metadata.
     * @param int    $user_id The user ID.
     */
    return apply_filters('get_the_author_' . $field, $value, $user_id);
}

WordPress Version: 3.7

/**
 * Retrieve the requested data of the author of the current post.
 * @link http://codex.wordpress.org/Template_Tags/the_author_meta
 * @since 2.8.0
 * @uses $authordata The current author's DB object (if $user_id not specified).
 * @param string $field selects the field of the users record.
 * @param int $user_id Optional. User ID.
 * @return string The author's field from the current author's DB object.
 */
function get_the_author_meta($field = '', $user_id = false)
{
    if (!$user_id) {
        global $authordata;
        $user_id = isset($authordata->ID) ? $authordata->ID : 0;
    } else {
        $authordata = get_userdata($user_id);
    }
    if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status'))) {
        $field = 'user_' . $field;
    }
    $value = isset($authordata->{$field}) ? $authordata->{$field} : '';
    /**
     * Filter the value of the requested user metadata.
     *
     * The filter name is dynamic and depends on the $field parameter of the function.
     *
     * @since 2.8.0
     *
     * @param string $value   The value of the metadata.
     * @param int    $user_id The user ID.
     */
    return apply_filters('get_the_author_' . $field, $value, $user_id);
}