Opened 18 years ago
Closed 17 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: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 2.7 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
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)
Change History (3)
#1
@
18 years ago
- Keywords has-patch added
- Version → 2.7
Attached patch based on the comments above. not tested.
#2
@
17 years ago
- Milestone 2.8
- Resolution → invalid
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
query.php patch based on ticket comments