[wp-trac] [WordPress Trac] #8870: Author pages give a 404 when the author has only written pages, not posts.

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 16 21:56:12 GMT 2009


#8870: Author pages give a 404 when the author has only written pages, not posts.
--------------------------+-------------------------------------------------
 Reporter:  truthmedia    |       Owner:  anonymous
     Type:  defect (bug)  |      Status:  new      
 Priority:  normal        |   Milestone:  2.8      
Component:  General       |     Version:           
 Severity:  normal        |    Keywords:           
--------------------------+-------------------------------------------------
 We have found that the author pages (the page which displays all
 pages/posts created by an author) only work with posts and not pages.
 Therefore, if an author has written numerous pages but no posts, when the
 visitor attempts to view other pages written by the same author they are
 shown a 404 page.  In order to fix this problem, we have added the
 following code to the wp-includes/query.php file at line 2073 in WordPress
 v. 2.7.

 } elseif ( $this->is_author ) {
         $where .= '';

 The entire code block with our change is as follows from line 2067 to
 2079.

 if ( $this->is_attachment ) {
         $where .= " AND $wpdb->posts.post_type = 'attachment'";
 } elseif ($this->is_page) {
         $where .= " AND $wpdb->posts.post_type = 'page'";
 } elseif ($this->is_single) {
         $where .= " AND $wpdb->posts.post_type = 'post'";
 } elseif ( $this->is_author ) {
         $where .= '';
 } elseif ( 'any' == $post_type ) {
         $where .= '';
 } else {
         $where .= " AND $wpdb->posts.post_type = '$post_type'";
 }

 Thanks a bunch,
 James

-- 
Ticket URL: <http://trac.wordpress.org/ticket/8870>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list