Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#8870 closed defect (bug) (invalid)

Author pages give a 404 when the author has only written pages, not posts.

Reported by: truthmedia Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: has-patch
Focuses: Cc:


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

Attachments (1)

query.diff (536 bytes) - added by mrmist 9 years ago.
query.php patch based on ticket comments

Download all attachments as: .zip

Change History (3)

9 years ago

query.php patch based on ticket comments

#1 @mrmist
9 years ago

  • Keywords has-patch added
  • Version set to 2.7

Attached patch based on the comments above. not tested.

#2 @Denis-de-Bernardy
9 years ago

  • Milestone 2.8 deleted
  • Resolution set to invalid
  • Status changed from new to closed

this is invalid.

author pages don't list static pages for the same reason that tags don't list static pages. those pages are supposed to list posts, ordered by date desc.

if another behavior is expected, it's a plugin's job to go in there and change the query.

Note: See TracTickets for help on using tickets.