Opened 9 years ago
Last modified 6 days ago
#37202 new defect (bug)
the_archive_title() doesn't output the author's display name if that author hasn't posted
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.5.3 |
Component: | Users | Keywords: | has-patch reporter-feedback |
Focuses: | template | Cc: |
Description
In my archive.php template, if I do this:
get_header(); the_archive_title( '<h1>', '</h1>' ); // Rest of code...
and then take a look at example.com/author/joebloggs, I expect to see:
Author: Joe Bloggs
The problem is if joebloggs hasn't posted yet, I see this:
Author:
Attachments (1)
Change History (9)
#4
@
9 years ago
- Keywords has-patch added; needs-patch removed
37202.diff uses get_the_queried_object()
to output the author's display name on author archives. Now, the_archive_title()
will output a title even if the author hasn't posted.
#7
@
6 days ago
- Keywords reporter-feedback added; needs-testing removed
Reproduction Report
Description
❌ This report validates the issue is not reproduced.
Environment
- WordPress: 6.8.1
- PHP: 8.2.23
- Server: nginx/1.26.1
- Database: mysqli (Server: 8.0.35 / Client: mysqlnd 8.2.23)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Seventeen 3.9
- MU Plugins: None activated
- Plugins:
- Advanced Custom Fields 6.4.2
- Test Reports 1.2.0
Actual Results
- ❌ Error condition not occurs (not reproduced).
Additional Notes
- I have created one author -
devtest
as Contributor role. This author have not publish any post yet - Visit the author archive url. Ex.
https://example.com/author/devtest/
- I'm showing the 404 page. Because this author have not publish any post yet.
- If I assign post to this author, this author archive url shows post list.
- This is the expected behavior. And nothing found any issue in this.
Supplemental Artifacts
Screenshot: https://prnt.sc/dAn2MThYczam
Note: See
TracTickets for help on using
tickets.
I've traced the issue back to the use of the
$authordata
global, which is used insideget_the_author()
.Dumping
$authordata
in the author template and then visiting a user's archive I get either an object of typeWP_User
(for users who have posted) ornull
(for users who haven't posted).