Skip to content

Photo Directory: Remove the duplicate image from feed content - #1099

Open
ekamran wants to merge 1 commit into
WordPress:trunkfrom
ekamran:shifteq/photo-feed-duplicate-image
Open

ekamran wants to merge 1 commit into
WordPress:trunkfrom
ekamran:shifteq/photo-feed-duplicate-image

Conversation

@ekamran

@ekamran ekamran commented Oct 24, 2026 •

Copy link
Copy Markdown

Each item in the Photo Directory feeds shows the photo twice, one copy under the other, for example in https://wordpress.org/photos/feed/ and https://wordpress.org/photos/feed/atom/.

r12989 added a copy of the photo with its description as the alt text, to make the feed more accessible, but the old line that outputs the photo without an alt argument stayed in. So add_photo_to_rss_feed() outputs two <img> tags with the same src: the first with the description as alt, the second with alt="". On 2026-10-24, all 50 items in the RSS feed and all 50 entries in the Atom feed had both copies.

This removes the old line and keeps the one with the description as alt.

Without an alt argument, the removed copy would use the attachment's own alt text if one were set. The plugin does not set it, the theme's inject_img_alt_text() always uses the description as the alt of the image on the photo page, and none of the 899 photo attachments I checked through the REST API, from 2021 to 2026, has one. So the feed image now has the same alt as the photo page.

Testing

In a local WordPress trunk site, I loaded the plugin's registrations.php and posts.php, hooked add_photo_to_rss_feed() on the_content_feed, created photo posts with featured images, made them the main feed query, and rendered core's feed templates:

  • RSS2, Atom and RDF: 2 <img> tags per item before, 1 after. The kept <img> and the figcaption are the same before and after.
  • Empty description: 2 before, 1 after, with alt="".
  • Empty description with alt text set on the attachment: before, the second copy had the attachment's alt text; after, the only image has alt="", the same as the theme code gives the photo page.
  • Description stored as HTML (&amp;, &quot; and a tag): the kept <img> has the same alt before and after.
  • Four items: core's lazy loading still leaves the first three images without loading="lazy", which now means the first three items instead of the first one and a half.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: Finding the bug while reading the plugin, checking the live feeds and attachments, the local feed tests, and the wording of this description. I reviewed the change and the results, and I take responsibility for the contribution.

Summary by CodeRabbit

  • Accessibility
    • RSS photo thumbnails now include descriptive alternative text drawn from the post content, helping screen-reader users understand the images. Existing figure and caption display remains unchanged.

r12989 added a copy of the photo with the description as alt text but kept the old copy without it, so every feed item showed the photo twice.
@github-actions

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 ekamran.

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 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.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0b2223db-07f7-467d-8579-83cd096ecadd
Commits

Reviewing files that changed from the base of the PR and between b2f125f and 7a32178.

Files selected for processing: 1
  • wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php
Files with no reviewable changes: 1
  • wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The RSS photo markup now sets the thumbnail’s alt attribute to the post’s trimmed, tag-stripped content. The existing figure and optional caption output remain unchanged.

Changes: RSS thumbnail markup

Layer / File(s) Summary
Set thumbnail alt text
wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php
The thumbnail call uses trimmed, tag-stripped post content as its alt text.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Merge Risk: Minimal · up to 7a321

Photo feed items now contain one image with description alt text. No issue identified here prevents merging.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: removing the duplicate image from Photo Directory feed content.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant