Support » Fixing WordPress » cant get user level with get_the_author_meta

  • Resolved NormanBird


    Im using the below code trying to test the user level, and it keeps returning 0(zero) which i believe is subscriber, although roles page says user levels are 1-9???

    I get 0 when im running it as an admin user. So im posting code for help. I just need to test if its a subscriber or author.

    I posted several versions of get_the_author_meta() to cover all the basis and they all return 0.

    any help appreciated.

    // The Loop
    while ( $new_query->have_posts() ) : $new_query->the_post();
    // variables we will need
    $image =  wp_get_attachment_image_src(get_field('image1'), 'thumbnail');
    $custom = get_post_custom($new_query->ID);
    $title = get_the_title();
    $tagline = $custom["tagline"][0];
    $description = $custom["description"][0];
    $level = get_the_author_meta('user_level');
    echo $level;
    echo the_author_meta('user_level');

    I am using the plugin wp-emember also fyi. this is on the home page.

Viewing 1 replies (of 1 total)
  • My bad. the code works fine as is. it displayed a list of posts from many users and since i put the exit; i didnt see the complete list which does show the different user levels, I was just seeing the one correct one being displayed only. duh!!
    resolved. wasnt even a problem.

Viewing 1 replies (of 1 total)
  • The topic ‘cant get user level with get_the_author_meta’ is closed to new replies.