WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#3345 closed defect (bug) (duplicate)

Allow author.php to show even if author has 0 posts.

Reported by: ruckerz Owned by: westi
Milestone: Priority: normal
Severity: normal Version: 2.0.4
Component: Template Keywords:
Focuses: Cc:

Description

Loading /author/username will return a 404 if author has no posts. It is desirable to show something, in my case, author profiles and let author.php decide what to do if the author has 0 posts.

Rewrote handle_404() to...

if ( (0 == count($wp_query->posts)) && (!isset($wp_query->query_varscat?)
$wp_query->query_varscat?== 0) && (!isset($wp_query->query_varsauthor?) $wp_query->query_varsauthor? == 0) && !is_404() && !is_search() && ( $this->did_permalink (!empty($_SERVERQUERY_STRING?) && (false === strpos($_SERVERREQUEST_URI?, '?'))) ) ) {


Note this includes patches from Trac #1969 (Check for category and author page existence) and also solves final comment by _ck_.

Attachments (1)

classes-php.diff (1.4 KB) - added by JDTrower 7 years ago.
This patch allows for author and category pages to show even if there are 0 posts.

Download all attachments as: .zip

Change History (9)

comment:1 @markjaquith9 years ago

would that show author.php for authors who don't exist?

comment:2 @matt8 years ago

  • Milestone changed from 2.1 to 2.2

comment:3 @foolswisdom8 years ago

  • Milestone changed from 2.2 to 2.4

@JDTrower7 years ago

This patch allows for author and category pages to show even if there are 0 posts.

comment:4 @JDTrower7 years ago

  • Keywords has-patch needs-testing added

I have posted a patch that will load the author or category page even if it has 0 posts, as long as the author or category exists. In my testing, it won't work if the author or category doesn't exist. This patch fixes tickets #3345 and #1969.

comment:5 @JDTrower7 years ago

Just as a thought, it would be beneficial if someone that actually utilizes the author pages would test this out to ensure that it is working as intended. In the testing that I did, it works.

comment:6 @westi7 years ago

  • Owner changed from anonymous to westi
  • Status changed from new to assigned

comment:7 @caesarsgrunt7 years ago

  • Resolution set to duplicate
  • Status changed from assigned to closed

Duplicate of #5324. This one was open first, it's true, but it hasn't been modified for far longer.

comment:8 @jacobsantos7 years ago

  • Keywords has-patch needs-testing author no posts removed
  • Milestone 2.9 deleted
Note: See TracTickets for help on using tickets.