Support » Themes and Templates » WordPress displays wrong author

  • Resolved jessor


    I have a multiuser blog and display author information in widgets. The code looks like this:

    if(!is_single()) {
            $return  = '<h3>Ansprechpartner</h3>';
            $return .= get_avatar(get_the_author_meta('user_email'), '70');
            $return .= get_the_author_posts_link() . '<br />';
            $return .= 'Telefon: ' . get_the_author_meta('telefon') . '<br />';
            $return .= '<a href="mailto:' . get_the_author_meta('email') . '">Email</a>';

    Everything works fine *except* on this one page, it displays the wrong user. No matter what I set in the page editor, it always displays one specific user (not the first, not the latest user).

    I took a look in the posts table, the correct userid is set. Anyone seen this behaviour?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Found my problem. I use a shortcode on this page which lists posts and thus the widget shows the info for the last shown page.

    For anyone who stumbles upon this.

    I did something like this:

    foreach($theposts as $thepost) {
        $output .= '<li><a href="'. get_permalink($thepost->ID) . '">' . get_the_title($thepost->ID) . '</a></li>';

    The problem is: setup_postdata does what it’s supposed to do and changes the context of the current post or page. Since WordPress 3.0 there’s a clean way to fix this: use wp_reset_postdata(); before you return the output.



    Thank-you Jessor!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WordPress displays wrong author’ is closed to new replies.