Repository navigation
Conversation
GatherPress registers a calendar feed for every event-bearing taxonomy and every shadow-source post type, including those of companion plugins. get_ical_list() filtered only topics and venues, so the feed of any other term or source post listed all events. get_ical_list() now builds its filter from the queried object: the shadow term of a shadow-source post, or the queried term of an event-bearing taxonomy. Event\Query::get_events_list() accepts tax_query clauses for this, which also lets companion plugins filter by their own taxonomies. Fixes GatherPress#1642 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test Coverage Report✅ All coverage checks passed! ✅ PHP Coverage✅ JavaScript CoverageThis comment is automatically updated on each push. |
get_queried_object() is a term only on a term archive, and a post that is not a shadow source gives no clause, so the is_singular() and is_tax() checks repeated the type checks. Dropping them brings the Setup class complexity back under the PHPMD limit (146, from 147 on develop). Add a test that covers get_queried_tax_query() when nothing filters the feed: the events archive and a page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Preview changes with PlaygroundCustomize PR PlaygroundTo customize the Playground preview for this specific PR, create a file at:
The override is merged into the generated blueprint and can be used to:
Example: {
"$schema": "https://gatherpress.org/playground-preview/pr-override-schema.json",
"landingPage": "/wp-admin/edit.php?post_type=gatherpress_venue",
"siteOptions": {
"show_on_front": "page"
},
"features": {
"networking": true
},
"prependSteps": [
{
"step": "installPlugin",
"pluginData": {
"resource": "wordpress.org/plugins",
"slug": "simple-location"
},
"options": {
"activate": true
}
}
],
"appendSteps": [
{
"step": "runPHP",
"code": ""
}
]
}Go to Playground PR preview customization for more details. You can preview the recent changes for PR#2662 with the following PHP versions: PHP Version 8.4PHP Version 8.2PHP Version 8.1Download Made with 💙 from GatherPress & a little bit of WordPress Playground. Changes will not persist between sessions. |
wppoland
left a comment
There was a problem hiding this comment.
LGTM! Clean fix for #1642:
Calendar\External\Setup::get_queried_tax_query()uses the sameis_tax_like_type_for_event_supporting_types()andhas_post_type_for_taxonomy()checks that register the feed endpoints, delegating shadow-source posts toShadow_Source::build_tax_query_clause()and event-bearing taxonomy terms to aterm_idclause.Event\Query::get_events_list()cleanly accepts array clauses intax_queryalongsidetopicsandvenueswhile ignoring non-array entries.- Great test coverage in
class-test-setup.phpandclass-test-query.phpfor companion taxonomies, companion shadow-source post types, unfiltered archive/page requests, and malformedtax_queryinputs.
Fixes #1642
Proposed changes:
GatherPress registers a calendar feed for every event-bearing taxonomy and every shadow-source post type, including those of companion plugins. But
Calendar\External\Setup::get_ical_list()filtered only topics and venues, so the feed of any other term or source post listed all events.get_ical_list()now builds its filter from the queried object, in a newget_queried_tax_query():Shadow_Source::build_tax_query_clause();These are the same checks that decide which post types and taxonomies get a feed endpoint, so every endpoint now gets its own filter. Topic and venue feeds list the same events as before.
Event\Query::get_events_list()acceptstax_queryclauses for any other taxonomy. They join the topic and venue clauses with AND, and members that are not arrays are left out. Events API: More filters, e.g. by geolocation #1263 is closed, and the method already takes an args array, so this adds one key rather than a new API.docs/user/calendar-feeds.mdsays that companion taxonomies and shadow sources get feeds with only their events.A changelog entry is in
.github/changelog/ical-feed-any-taxonomy.Other information:
New tests: a companion taxonomy feed, a companion shadow-source feed, and the
tax_queryargument. The two feed tests fail ondevelop(the event without the term is in the feed) and pass with this change.Checked in
wp-env(PHP 8.3):AI assistance
Claude Code wrote the code, tests and docs. I reviewed the diff, ran the checks above, and checked the feeds over HTTP as in the testing instructions. The change only builds
WP_Querytax_query clauses from the queried object (aWP_PostorWP_Termthat WordPress resolved), and passes no request input to the query directly. Feeds still leave out password-protected events.Testing instructions:
Add a mu-plugin that registers a companion taxonomy and a shadow-source post type on events:
Flush the permalinks (Settings > Permalinks > Save).
Create two upcoming events, "Japanese Meetup" and "English Meetup". Publish a
gp_productionpost with the slughamlet.Give "Japanese Meetup" the
japaneseterm ingp_languageand the_hamletterm in_gp_production, for example withwp_set_object_terms().Open
/language/japanese/feed/ical/and/production/hamlet/feed/ical/. Each lists only "Japanese Meetup". Ondevelop, both list every upcoming event.Open a topic feed (
/topic/{slug}/feed/ical/), a venue feed (/venue/{slug}/feed/ical/) and/event/feed/ical/. They list the same events as ondevelop.My results:
develop/language/japanese/feed/ical//production/hamlet/feed/ical//topic/wordcamps/feed/ical//venue/hall-a/feed/ical//event/feed/ical/Credit (for release notes)
My WordPress.org username: tsubu
Changelog entry
The entry is already in the branch:
.github/changelog/ical-feed-any-taxonomy(Patch, Fixed).🤖 Generated with Claude Code