Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12072 closed defect (bug) (wontfix)


Reported by: ramiy Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.9
Component: General Keywords:
Focuses: Cc:


i dont know if its just me, but the the_author_meta() function stoped wirking outside the loop.

in my archive.php file i use this function befor the loop, and it's not working.

seems like it stoped working after upgraging to 2.9.

Change History (5)

comment:1 @scribu6 years ago

  • Milestone changed from 2.9.2 to 3.0
  • Version set to 2.9

Are you calling it before or after The Loop? What are the arguments?

comment:2 @ramiy6 years ago

  1. Before The Loop.
  2. the_author_meta('display_name');

comment:3 @scribu6 years ago

  • Milestone 3.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I think that's normal behaviour, since the $authordata variable hasn't been set yet.

You'll have to pass the user id as the second parameter.

comment:4 @ramiy6 years ago

in archive.php i echo the H1 title befor the loop.

if (is_category()) : echo single_cat_title();
elseif (is_tag()) :  echo single_tag_title();
elseif (is_author()) : the_author_meta('display_name');
elseif ...

how do i get $user_id in archive.php?

and why in 2.8 it worked without any problem?

comment:5 @scribu6 years ago

the_author_meta('display_name', $GLOBALS['posts'][0]->post_author);

Note: See TracTickets for help on using tickets.