Skip to content

General: Show the week in the title of weekly archives. - #15510

Open
DanielFloeter wants to merge 2 commits into
WordPress:trunkfrom
DanielFloeter:fix/weekly-archive-title
Open

DanielFloeter wants to merge 2 commits into
WordPress:trunkfrom
DanielFloeter:fix/weekly-archive-title

Conversation

@DanielFloeter

@DanielFloeter DanielFloeter commented Nov 5, 2026 •

Copy link
Copy Markdown

Weekly archive links contain both the year and the week (?m=2025&w=39), so is_year() is true and get_the_archive_title() and wp_get_document_title() used the year as the title.

Add a week branch before the year check in both functions. It uses the same date range as the weekly archive links from wp_get_archives(), e.g. "Week: September 22, 2025 – September 28, 2025".

See #66489.

Trac ticket: https://core.trac.wordpress.org/ticket/66489

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Implementation and tests drafted with Claude Code; reviewed, tested and adjusted by me.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Weekly archive links contain both the year and the week (`?m=2025&w=39`), so `is_year()` is true and `get_the_archive_title()` and `wp_get_document_title()` used the year as the title.

Add a week branch before the year check in both functions. It uses the same date range as the weekly archive links from `wp_get_archives()`, e.g. "Week: September 22, 2025 – September 28, 2025".

See #66489.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props kometschuh, pedrofigueroa1989.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Comment on lines +243 to +245
/**
* @ticket 66489
*/

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment/doc is not necessary (it's not used in the rest of the file).

Suggested change
/**
* @ticket 66489
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'd prefer to keep it: per the Core handbook, @ticket marks tests that address a Trac ticket and is mapped to @group, so phpunit --group 66489 runs all tests for this change. It's also already used in this file (@ticket 6479 on test__wp_render_title_tag_with_blog_description).

public function test_week_title() {
update_option( 'start_of_week', 1 );

$this->go_to( '?m=2015&w=39' );

@mardelnet mardelnet Nov 27, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also test a URL like this: $this->go_to( '/2015?w=39' ); ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added test_week_title_without_year in c059a75.

@mardelnet mardelnet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code changes look good to me.
I'm only adding some optional suggestions/comments.

date_i18n( $date_format, $week['start'] ),
date_i18n( $date_format, $week['end'] )
);
$prefix = _x( 'Week:', 'date archive title prefix' );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This string has to be translated for the different language packs when these changes are merged.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Add a test for `wp_get_document_title()` on `?w=39`, where only the week is set.

See #66489.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants