Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Correct use of get_queried_object() for author archives.

The ->data object (used previously) stores the author data, but the WP_User class has the __get magic method that grants access to that data, so using get_queried_object() without ->data is correct, and compatible with 3.2, which does not use magic methods. Also url-escapes get_author_posts_url.
  • Loading branch information...
commit 103ae2cdf6150e2d6f660eb101ff968666e40a87 1 parent dec5c61
@kovshenin authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 archive.php
View
4 archive.php
@@ -26,8 +26,8 @@
} elseif ( is_author() ) {
// Get the queried author data.
- $author = get_queried_object()->data;
- printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( $author->ID ) . '" title="' . esc_attr( $author->display_name ) . '" rel="me">' . esc_html( $author->display_name ) . '</a></span>' );
+ $author = get_queried_object();
+ printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( $author->ID ) ) . '" title="' . esc_attr( $author->display_name ) . '" rel="me">' . esc_html( $author->display_name ) . '</a></span>' );
} elseif ( is_day() ) {
printf( __( 'Daily Archives: %s', '_s' ), '<span>' . get_the_date() . '</span>' );
Please sign in to comment.
Something went wrong with that request. Please try again.