Skip to content

Remove stale rewrite flush from theme demo blueprint#220

Merged
bgrgicak merged 1 commit into
WordPress:trunkfrom
ekamran:remove-theme-demo-flush-rules
Jul 16, 2026
Merged

Remove stale rewrite flush from theme demo blueprint#220
bgrgicak merged 1 commit into
WordPress:trunkfrom
ekamran:remove-theme-demo-flush-rules

Conversation

@ekamran

@ekamran ekamran commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove the stale rewrite.php mu-plugin example that calls flush_rules().
  • Use a small writeFile example that adds a demo body class instead.
  • Switch the Kanso theme source to git:directory so PR Blueprint validation accepts the external source.
  • Point the WXR import to this branch raw URL for PR validation.

Dependency

This supports WordPress/wordpress-playground#3806. Once this PR lands, that Playground docs PR can keep the Run Blueprint link pointing to Blueprints trunk.

cc @bgrgicak based on the review direction in WordPress/wordpress-playground#3806.

Testing

  • git diff --check
  • GITHUB_BRANCH='remove-theme-demo-flush-rules' CHANGED_FILES='blueprints/install-activate-setup-theme-from-gh-repo/blueprint.json' npm run validate:pr-blueprints

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Test using WordPress Playground

The changes in this pull request can be 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 one of the links below is clicked.

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

Blueprint previews

"file": {
"resource": "url",
"url": "https://github.com/WordPress/blueprints/blob/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint-content.xml"
"url": "https://raw.githubusercontent.com/wordpress/blueprints/remove-theme-demo-flush-rules/blueprints/install-activate-setup-theme-from-gh-repo/blueprint-content.xml"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This url doesn't work. Why do we need to change it?

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad, the URL change was not correct.

I have restored the existing Blueprint resource URLs and updated the validator instead. Now the PR only changes the old flush_rules() example, and the validator still checks any newly added external URLs.

@ekamran
ekamran force-pushed the remove-theme-demo-flush-rules branch from 303cbfb to fb7d4e2 Compare July 13, 2026 13:03
@@ -1,5 +1,6 @@
import fs from 'node:fs';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this change intentional?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was intentional.

When this Blueprint is touched, the validator checks all URLs in the file, including URLs that already existed on trunk. That forced me to change existing URLs, which was wrong.

This change keeps existing Blueprint URLs unchanged and only applies the branch URL check to newly added URLs. So the stale flush_rules() example is removed without changing unrelated Blueprint resources.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of modifying tests to pass CI, can we just fix the URL in the PR?
This URL should work https://raw.githubusercontent.com/wordpress/blueprints/trunk/blueprints/install-activate-setup-theme-from-gh-repo/blueprint-content.xml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hey, just to give clear context here.

We were working on WordPress Playground PR #3806, where the goal is to avoid the old flush_rules() example because it is not a good pattern for Playground docs/examples.

While checking that, we found the same old example in the Blueprints repo, so I opened blueprints#220 to update the source Blueprint also.

The main intended change in blueprints#220 is only this:
replace the old writeFile example that creates a mu-plugin calling flush_rules() with a safer small demo mu-plugin.

The validator change happened because once this Blueprint file was touched, CI started checking all URLs in that file, including URLs that already existed on trunk. I first changed the URL, but that was wrong, so I restored the resource URL and tried to make the validator only apply the PR-branch URL rule to newly added URLs.

But I understand your concern that this makes the PR wider than the original Blueprint cleanup. If you prefer, I can remove the validator change and keep this PR limited to the Blueprint example only. Just want to avoid changing unrelated URLs only to satisfy CI.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Or you can simply guide me on what we should do?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If you prefer, I can remove the validator change and keep this PR limited to the Blueprint example only. Just want to avoid changing unrelated URLs only to satisfy CI.

I would remove the validator changes from this PR. While it's annoying that CI forces us to update URLs in PRs that we didn't touch, it's also a way for us to slowly improve the state of the repository.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I removed the validator changes and tested the suggested URL locally.

The Blueprint passes validation when GITHUB_BRANCH=trunk.

However, the PR workflow sets GITHUB_BRANCH to remove-theme-demo-flush-rules, so the validator expects this URL:

https://raw.githubusercontent.com/wordpress/blueprints/remove-theme-demo-flush-rules/...

This URL returns a 404 because the branch exists only in my fork. The equivalent URL from my fork works, but the validator only accepts URLs from wordpress/blueprints.

How should we handle this for a fork PR?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for diving deeper into this! What do you think about this? https://github.com/WordPress/blueprints/pull/221/changes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

#221 is merged now so this PR should be unblocked.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I have reworked this PR on the latest trunk after #221 was merged.

It now changes only the Blueprint file. The validator changes are removed, the WXR URL uses the raw trunk URL, and Kanso uses git:directory while keeping the existing kanso-main folder name.

I also ran the complete Blueprint locally and checked the active theme and imported content. CI is passing now.

@ekamran
ekamran force-pushed the remove-theme-demo-flush-rules branch from fb7d4e2 to d6b8b91 Compare July 16, 2026 12:19
@bgrgicak
bgrgicak merged commit 6697215 into WordPress:trunk Jul 16, 2026
3 checks passed
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