Linux 软件免费装
Banner图

BlackSwan | Block External Request

开发者 blackswanlab
amirhpcom
更新时间 2026年3月10日 04:48
捐献地址: 去捐款
PHP版本: 5.4 及以上
WordPress版本: 6.8
版权: GPLv2 or later
版权网址: 版权信息

标签

performance blacklist whitelist external requests block http requests

下载

2.6.0 2.6.1 2.6.2

详情介绍:

BlackSwan Block External Request gives you granular control over every outgoing connection your WordPress site makes — both server-side PHP requests and browser-loaded JS/CSS resources. WordPress, plugins, and themes constantly send background HTTP requests: update checks, license pings, analytics, font downloads, CDN calls, and more. On slow servers or restricted hosting environments, these requests can add seconds to every admin page load. This plugin lets you block what you don't need and keep what you do. What it does Server-side HTTP Blocking (PHP) Intercepts outgoing wp_remote_get / wp_remote_post calls via the pre_http_request filter. Add domains to the blacklist and they'll be blocked before the request is even made. Whitelist specific URL patterns to let essential requests through (e.g. plugin update API). Browser-side Resource Blocking (JS/CSS by Domain) Deregisters enqueued JavaScript and CSS files loaded from blacklisted external domains. Toggle separately for admin panel and public frontend. Your own site's assets are never touched. Block Specific Resources (by URL) Block individual JS or CSS files by full URL, partial path, or even just a filename — works for both local and external resources. Per-item backend/frontend toggle. Perfect for removing unwanted plugin assets without editing code. Features Who is this for? Developer Hooks Two filters are available for developers to customize blocking behavior programmatically. These run on every page load and merge with the values from the settings page. BlackSwan\block_external_request\block_url_list Filter the array of blocked domain strings. Each entry is matched via strpos() against the full request URL. add_filter( 'BlackSwan\block_external_request\block_url_list', function( $domains ) { $domains[] = 'analytics.example.com'; return $domains; }); BlackSwan\block_external_request\whitelist_urls Filter the array of whitelisted URL patterns. If a blocked URL also matches a whitelist pattern (via strpos()), the request is allowed through. add_filter( 'BlackSwan\block_external_request\whitelist_urls', function( $patterns ) { $patterns[] = '//api.example.com/v2/license'; return $patterns; }); Whitelist patterns take priority over blacklist domains. Both filters accept and return a flat array of strings. Links

安装:

  1. Upload the blackswan-block-external-request folder to /wp-content/plugins/
  2. Activate the plugin through the Plugins menu in WordPress
  3. Go to Settings → Block External Request to configure
Or install directly from WordPress:
  1. Go to Plugins → Add New
  2. Search for "BlackSwan Block External Request"
  3. Click Install Now, then Activate
The plugin comes pre-configured with a sensible default blacklist and whitelist. You can customize everything from the settings page.

屏幕截图:

  • Previous version information with no UI

升级注意事项:

2.6.2
  • Added pre-defined list of common analytics/tracking domains to the default blacklist (e.g. Google Analytics, Hotjar, Matomo etc.)
  • Added pre-defined list of common Iranian payment gateway domains to the default blacklist (e.g. Zarinpal, Pay.ir, IDPay etc.)
  • DEV: Added BlackSwan\block_external_request\blocked_resources filter to allow programmatic blocking of specific JS/CSS resources by URL pattern
2.6.0 Major UI overhaul with liquid glass design and inline SVG icons. Fully standalone — no external dependencies. Safe to upgrade, all settings preserved. For the full changelog, see GitHub Repository.

常见问题:

Will this break my site?

It depends on what you block. The default blacklist blocks common domains that slow down the admin panel (wordpress.org, google.com, yoast.com, etc.). The default whitelist ensures plugin update API calls still work. If something breaks, use the Pause button or Safe Mode to quickly restore access.

What's the difference between the three blocking sections?

  1. Server-side HTTP (PHP) — Blocks background requests made by WordPress via PHP. These are invisible to the browser (update checks, API calls, license pings).
  2. Browser-side by Domain — Dequeues JS/CSS files loaded from blacklisted external domains (e.g. Google Fonts, CDN libraries).
  3. Block Specific Resources — Dequeues individual JS/CSS files by matching any part of their URL. Works for local files too.

I blocked something and now I can't access wp-admin

Add ?bswan-safe=1 to any admin URL (e.g. yoursite.com/wp-admin/?bswan-safe=1). This bypasses all blocking for that page load. The plugin settings page also automatically skips resource blocking.

Does this affect the frontend?

Server-side HTTP blocking applies everywhere. Browser-side resource blocking and specific resource blocking have separate toggles for backend and frontend — you control where each applies.

Where are settings stored?

All settings are stored as a single JSON value in wp_options with autoload=no for optimal performance. No separate database tables.

Can I export/import settings between sites?

Yes. The Export/Import panel in the sidebar lets you download all settings as a JSON file and import it on another site.

How can I contribute?

We welcome contributions! You can:

更新日志:

2.6.2 2.6.0 2.5.0 2.4.0 2.3.1 2.3.0 2.2.0 2.1.0 2.0.0 1.1.0 1.0.0