Repository navigation
Conversation
The experiment only scheduled a rewrite rules flush when its enabled option was added or updated. When the rules were rebuilt while the feed was not registered (the plugin was inactive during a flush, or the flush ran with plugins skipped), or when the experiment was enabled by filter, the stored rules did not list the feed and nothing added it back. /feed/markdown/ returned 404 while the page head still advertised it. maybe_flush_rewrite_rules() now also flushes when the feed is registered but no root feed rule in the stored rules lists it. A flush that does not bring the feed back is not repeated for an hour.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1110 +/- ##
=============================================
+ Coverage 81.55% 81.58% +0.02%
- Complexity 3074 3081 +7
=============================================
Files 129 129
Lines 12261 12275 +14
=============================================
+ Hits 10000 10015 +15
+ Misses 2261 2260 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Test ReportPatch tested: #1110 (commit f88a8d2), compared with Environment
Steps
Results
✅ The patch fixes #1109. |
What?
Closes #1109
Makes the Markdown Feeds experiment rebuild the rewrite rules when its feed is registered but the stored rules do not list it, so the advertised
/feed/markdown/URL no longer returns 404.Why?
The experiment schedules a rewrite rules flush only when its enabled option is added or updated. When the rules are rebuilt while the feed is not registered (the plugin was inactive during a flush, or
wp rewrite flush --skip-plugins), or when the experiment is enabled with thewpai_feature_markdown-feeds_enabledfilter, the stored rules do not list the feed and nothing adds it back./feed/markdown/and the per-archive feeds return 404 while the page head still advertises the feed. Steps and details are in #1109.How?
maybe_flush_rewrite_rules()keeps the scheduled flush as it is. It now also flushes when the feed is registered with WordPress but no root feed rule in the stored rules lists it.wp_loaded, before the request is routed. So the first request after the rules went stale is already served correctly, even when that request is the feed itself.get_option( 'rewrite_rules' ). While the experiment is off, the check returns before reading the option.docs/experiments/markdown-feeds.md.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code and Codex
Used for: Investigation, implementation, tests, verification harness, and PR wording. I reviewed the reasoning and test results, and I take responsibility for the contribution.
Testing Instructions
/feed/markdown/shows the feed./feed/markdown/. Ondevelopit is the 404 page. With this PR it shows the feed.wp rewrite flush --skip-pluginsand open/feed/markdown/again. Same result.add_filter( 'wpai_feature_markdown-feeds_enabled', '__return_true' );in a small plugin. Same result.Automated:
npm run test:php -- --filter Markdown_passes with 41 tests and 85 assertions. Eleven tests are new. Five of them fail ondevelopand pass here. The other six check that nothing is flushed when it should not be.WP_MULTISITE=1.composer lintand PHPStan pass.Also verified by hand in wp-admin on a local WordPress 7.1 site with steps 1 to 3, before and after. Steps 4 and 5, five permalink structures and plain permalinks were verified with scripted requests, before and after.
Changelog Entry