Skip to content

Disable webmentions for non-production environments#595

Draft
pfefferle wants to merge 2 commits intomainfrom
fix/588-disable-non-production
Draft

Disable webmentions for non-production environments#595
pfefferle wants to merge 2 commits intomainfrom
fix/588-disable-non-production

Conversation

@pfefferle
Copy link
Copy Markdown
Owner

Summary

  • Disables webmention sending, receiving, and discovery when WP_ENVIRONMENT_TYPE is local, development, or staging
  • Production and unset environments remain unaffected (default WordPress behavior treats unset as production)
  • Adds a webmention_disable_for_environment filter that receives the disable boolean and the environment type string, allowing developers to override

Test plan

  • Set WP_ENVIRONMENT_TYPE to local and verify no webmentions are sent or received, and discovery headers are absent
  • Set WP_ENVIRONMENT_TYPE to production (or leave unset) and verify webmentions work normally
  • Use the webmention_disable_for_environment filter to override the default behavior (e.g., force-enable on staging)
  • Verify other plugin features (comments, avatars, blocks, admin) still work on non-production environments

Fixes #588

Add an additional empty check after mb_convert_encoding() to prevent
a ValueError when loadHTML() receives an empty string in PHP 8.1+.

Fixes #332
When WP_ENVIRONMENT_TYPE is 'local', 'development', or 'staging',
webmention sending, receiving, and discovery are disabled. Production
and unset environments remain unaffected.

Adds a `webmention_disable_for_environment` filter so developers can
override this behavior.

Fixes #588
@pfefferle pfefferle marked this pull request as draft March 30, 2026 17:21
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.

Disable webmentions for staging, development, and local environments.

1 participant