Repository navigation
Add snippet for Disable WP REST API compatibility - #3857
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The documented installation can overwrite Disable WP REST API and remove its REST restrictions.
Review effort: Balanced
Findings: 1
What changed in this PR
Adds an opt-in compatibility snippet that keeps ActivityPub endpoints accessible when Disable WP REST API restricts REST access, without changing the main plugin.
Changes:
- Allows resolved ActivityPub routes while preserving existing allowlist entries.
- Documents installation and compatibility boundaries.
- Adds regression tests and snippet-testing guidance.
| File | Description |
|---|---|
| tests/README.md | Documents snippet test placement and cleanup. |
| tests/phpunit/tests/snippets/disable-wp-rest-api/class-test-disable-wp-rest-api.php | Tests route matching, exclusions, and allowlist preservation. |
| snippets/README.md | Adds the snippet to the catalog. |
| snippets/disable-wp-rest-api/README.md | Explains installation, behavior, and requirements. |
| snippets/disable-wp-rest-api/disable-wp-rest-api.php | Implements the ActivityPub route exception. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Related: https://wordpress.org/support/topic/conflicts-between-activitypub-and-disable-wp-rest-api/#post-19037585
Proposed changes:
Other information:
All 18 snippet tests (20 assertions) and targeted PHPCS pass. A focused code review found no actionable issues.
Skip Changelog: snippets are opt-in and excluded from the distributed plugin.Testing instructions:
rest_login_required.snippets/disable-wp-rest-api/intowp-content/plugins/and activate Allow ActivityPub through Disable WP REST API. Alternatively, put its PHP file inwp-content/mu-plugins/./wp-json/activitypub/1.0/actors/<id>endpoint and/.well-known/webfinger?resource=acct:<account>@<domain>. They should reach ActivityPub normally./?rest_route=/activitypub/1.0/actors/<id>. Verify/wp-json/wp/v2/usersremains restricted, including when a query parameter contains an ActivityPub URL.npm run env-test -- --filter=Test_Disable_Wp_Rest_Api.Changelog entry
Changelog Entry Details
Significance
Type
Message