0

hi and thanks for reading i try to grab the authors slug in the backend.

get_the_author_meta( 'user_nicename' );

is empty. i tried to google this issue, but cant find any concrete info on how to handle the backend. any hints would be nice. i keep writing to meet the quality standards. sorry for spaming but this seems to be the only solution. call it spam, i call it anyoing, but i wont complain, cause otherwise, what stupid text would end up here, just to get a little help.

1

Please read the codex on this function. Outside of the loop, your second arg must be a user ID. Inside the loop, WP grabs it from the post data.

get_the_author_meta('user_nicename', $userID);
  • ok. got it, thank you. was confused cause it worked in some other place (well, in the loop). – honk31 Dec 11 '11 at 12:46
1

to get, what i wanted, not just in the loop, but also in the backend, i wrote

function my_function( $id = 0 ) {
    $post = &get_post($id);
    $author = get_userdata($post->post_author);
    $user_url = $author->user_nicename;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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