I'm trying to get all arguments for function get_the_author_meta() or the_author_meta() because I have custom profile fields such as "parent name" and so, not only the normal arguments which is in Function_Reference/the_author_meta

I tried php func_get_args() but I can't make it work

any suggestions ?

2 Answers 2


I think you are confusing function arguments with author (user) meta fields. To get all user meta fields you can use get_user_meta() with empty $key parameter. For example, for user with ID 45:

$user_meta = get_user_meta( 45 );

$user_meta will be an array with all meta fields for the user with ID = 45.


The user meta, including the custom ones, are saved in the wp_usermeta table. You can get all user properties and meta keys using get_userdata( $userid ), an alias of get_user_by( 'id' ) , which returns a WP_User object or false on failure (the user with that ID does not exist).

Furthermore, you can determine if a certain meta key or property is set for a certain user using __isset($key). You can access a meta key or property using __get($key);

For example, you can make a shortcode to display user properties and/or meta keys with

add_shortcode('get-user-property', 'get_user_property');
function get_user_property( $atts ) {
    $atts = shortcode_atts( array(
        'user' => get_current_user_id(),
        'key' => 'display_name',
    ), $atts, 'get-user-property');
    $ud = get_userdata($atts['user']);
    return $ud ? 
        ($ud->__isset($atts['key']) ?
            $ud->__get($atts['key']) :
            (isset($ud->{$atts['key']}) ? 
                $ud->{$atts['key']} : 
                '[not set]'
        ) : 
        '[user does not exist]';

Now you can get any user property/meta-key using [get-user-property user="%id%" key="%field_name%"] anywhere you have shortcodes enabled. If the prop is not set for a user, it will return [not set], or [user does not exist] if you got the wrong ID.

If run without any arguments, it will return the display_name of the current user.

  • @ Andrei Thank you very much, I'm getting [user does not exist] I did the shortcode plugin and in the custom theme page I add $userID=get_current_user_id(); echo do_shortcode("[get-user-property user=\"$userID\" key=\"user_nicename\"]"); am I missing something? Jan 25, 2015 at 14:23
  • 1
    Did some testing, updated the code. Should be good now for all props.
    – tao
    Jan 25, 2015 at 15:01
  • Btw, if you use this in page content, you don't need to wrap the shortcode in do_shortcode(). You only need this in php files.
    – tao
    Jan 25, 2015 at 15:11
  • That one working, I could grab data and the good thing is that it's shortcode, but again I can't get all list of arguments :) Jan 25, 2015 at 15:15
  • 1
    To see all user properties var_dump ( get_userdata($userid) ); in some test page. Or use adminer to test queries on wp_usermeta table. You need get_user_meta($userid) to get all the custom properties. They are only available to WP_User object through __get() method.
    – tao
    Jan 25, 2015 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.