This guide covers which outgoing connections your site makes through the WordPress HTTP API, why they can be a risk, and how to audit them before you block anything.
The external connections your WordPress site makes every day
Every day, your WordPress website quietly reaches out to dozens of external servers in the background, often without any visible indication to you as the site administrator. Plugin update checks, license validations, analytics pings and third-party API calls all go through these outbound connections, and the list grows with every plugin you install.
Most of the time, these connections are completely harmless and even necessary for your site to function properly.
WordPress needs to check for core updates, your plugins need to verify licenses, and your analytics tools need to send data.
But here’s the critical question: Do you actually know which external services are being contacted? More importantly, do you have control over which connections are allowed?
The reality is that your installed plugins have unrestricted freedom to make connections to any external API they want. No approval needed.
This may create a potential security risk that many WordPress site owners aren’t even aware of.
Understanding the security implications
Uncontrolled external connections are a security risk because any plugin can send data out of your site, or pull data in, without you knowing. The main risks are data leakage, supply chain attacks, slower pages, compliance gaps and a bigger attack surface, and each one grows with every plugin that calls an outside service.
Data leakage: Plugins might transmit sensitive information to external servers, including site configuration details, user data, or content that should remain private.
Supply chain attacks: If a third-party service that your plugin connects to becomes compromised, attackers could potentially inject malicious code or data back into your site.
Performance issues: Excessive external requests can slow down your site, especially if a remote server is experiencing downtime or latency issues.
Compliance concerns: For sites operating under regulations like GDPR, HIPAA, or PCI DSS, unmonitored external connections can create compliance nightmares and audit trail gaps.
Attack surface expansion: Every external connection represents another potential entry point for attackers. Compromised third-party services can become vectors for malware infections on your WordPress site.
Keep in mind that the solution below only covers requests made through the WordPress HTTP API. Well-written plugins use it, but code that calls cURL directly can bypass it, so this is a strong control rather than a complete firewall.
WordPress’s built-in solution: HTTP API control
WordPress core already includes a built-in way to control external connections, and many WordPress developers don’t realize it. You don’t need to install another plugin or write a complex firewall rule: the solution is just two constants that you add to your wp-config.php file, as documented in the WordPress developer handbook.
The two-constant whitelist system
WordPress provides two constants that work together as an allowlist for external connections. WP_HTTP_BLOCK_EXTERNAL blocks every outgoing request made through the HTTP API, and WP_ACCESSIBLE_HOSTS lists the domains that are still allowed through. Requests to your own site and localhost always go through, so you only list the outside services you trust.
WP_HTTP_BLOCK_EXTERNAL: When set to true, this constant blocks all outgoing requests made through the WordPress HTTP API by default. Think of it as closing all the doors and windows in your house.
WP_ACCESSIBLE_HOSTS: This constant defines exactly which domains you trust and want to allow connections to. These are the “doors” you’re choosing to keep unlocked.
Implementation is straightforward. Add these lines to your wp-config.php file and edit the accessible hosts accordingly.
define('WP_HTTP_BLOCK_EXTERNAL', true);
define('WP_ACCESSIBLE_HOSTS', '*.wordpress.org');This configuration blocks all external requests made through the HTTP API except to wordpress.org subdomains, which handle core, plugin and theme updates and downloads. Requests to your own site and localhost are always allowed, so you don’t need to list them. You can add more hosts as a comma-separated list, and wildcards like *.example.com are supported.
Who benefits most from this approach?
Blocking external connections is most valuable for sites where an unexpected outgoing request could cause real harm: enterprise and regulated sites, staging copies, high-security client sites and sites where wp-admin feels slow. For a simple blog with a few trusted plugins, the default WordPress behavior is usually fine.
Enterprise websites: Organizations with strict security policies and compliance requirements benefit from the ability to audit and control all external communications.
Staging and development environments: Staging sites shouldn’t be making live API calls to payment processors, email services, or production analytics platforms. Blocking external connections prevents accidental charges, email sends, or data pollution.
Performance optimization: Reducing unnecessary external requests can improve load times, especially in wp-admin, and reduce server resource consumption.
Regulated industries: Healthcare, finance, legal, and other industries handling sensitive data need complete visibility into what information leaves their servers and where it goes.
High-security client sites: Agencies managing sites for government entities, financial institutions, or other security-conscious clients can offer this as an additional layer of protection.
The right way to implement connection blocking
The right way to implement connection blocking is to audit first, then block. Enabling these constants without research will almost certainly break important features on your site, such as payments, email delivery or license checks, so follow the four steps below: audit your connections, build an allowlist, test thoroughly and keep monitoring.
Step 1: Audit your current connections
Before blocking anything, you need to understand what external connections your site currently makes. The best way to do this is using a plugin like Query Monitor, which provides detailed information about all HTTP requests your site makes, including the plugin that made each request and the response it got.
Install Query Monitor, navigate through your site’s key pages and functions, then review the HTTP requests panel. Try to simulate all possible user actions and workflows on your site.
Requests made during WP-Cron runs won’t show up in a normal page view, so also trigger the scheduled tasks (for example with WP Crontrol) while auditing.
Step 2: Build your allowlist
Your allowlist is the set of domains your site is still allowed to contact once blocking is on. Based on the data from Query Monitor, create a comprehensive list of domains that your site legitimately needs to access. Here are common domains you’ll likely need to include:
WordPress core: *.wordpress.org for core, plugin, and theme updates (update checks on api.wordpress.org, downloads from downloads.wordpress.org)
Payment processors: If you run an e-commerce site, you’ll need domains for Stripe (api.stripe.com), PayPal, or whatever payment gateway you use
Email service providers: API-based mailers such as SendGrid (api.sendgrid.net) or Microsoft 365 (graph.microsoft.com, login.microsoftonline.com). Plain SMTP connections don’t go through the HTTP API, so they aren’t affected.
CDN and media services: If you use services like Cloudinary that your plugins interact with server-side to fetch, transform, or manage media files
Essential third-party APIs: Weather APIs, mapping services, social media integrations, or other services critical to your site’s functionality
Step 3: Implement and test thoroughly
Add the constants to your wp-config.php file with your complete allowlist, ideally on a staging copy first. Then test every part of the site that talks to an outside service, because a blocked request usually fails quietly instead of showing an error. For example:
- Test user registration and login.
- Process a test transaction if you have e-commerce functionality.
- Verify that contact forms send emails properly.
- Verify plugin and theme updates still work.
- Check Tools > Site Health, which also makes external requests and will report blocked ones.
Step 4: Monitor and maintain
Your allowlist isn’t a “set it and forget it” configuration. As you add new plugins, integrate new services, or update existing functionality, you’ll need to adjust your allowlist accordingly. Keep Query Monitor installed on your site but leave it deactivated in production. Activate it only when you need to audit connections and check what’s being blocked.
Broader WordPress security context
Controlling external connections is one layer of WordPress security, not a replacement for the others. It’s one piece of a comprehensive WordPress security strategy, and it works best when combined with the best practices below, from regular updates and strong authentication to backups, monitoring and a web application firewall.
Regular updates: Keep WordPress core, themes, and plugins updated. Outdated software is one of the most common entry points for attackers.
Strong authentication: Implement strong passwords, two-factor authentication, and limit login attempts to prevent brute force attacks.
Principle of least privilege: Give users only the permissions they absolutely need. Not everyone needs administrator access.
Regular backups: Maintain automated, off-site backups so you can quickly recover if something goes wrong.
Security monitoring: Use security plugins such as Wordfence to scan for malware, monitor file changes, and alert you to suspicious activity.
SSL/HTTPS: Encrypt all data in transit between your site and your visitors.
Web application firewall: Use Cloudflare or similar WAF services to filter malicious traffic before it reaches your server.
Database security: Use strong database passwords, change the default table prefix, and consider restricting database access by IP address.
File permissions: Set proper file and directory permissions to prevent unauthorized modifications.
Performance benefits beyond security
Controlling external connections can also make your site faster, not just more secure. Every external request made while a page is being generated adds latency to that page, and a slow or unreachable remote server can hold it up even longer. By eliminating unnecessary external calls, you reduce the number of potential points of failure and speed up your site.
Key takeaway
The key takeaway is that WordPress can already block unwanted external connections with two constants in wp-config.php, but not every site needs that level of control. For a simple blog or brochure site with just a few trusted plugins, the default WordPress behavior is probably fine.
However, if you’re managing client sites, working in regulated industries, handling sensitive data, or simply want to know exactly what your WordPress installation is doing behind the scenes, this functionality is invaluable.
WordPress security isn’t about implementing a single silver bullet solution. It’s about layering multiple security measures to create defense in depth.
Controlling external connections through the HTTP API is one more tool in your security toolkit. It’s a simple, effective way to reduce your attack surface and gain visibility into your site’s network activity.
Take the time to audit your site’s external connections, build a thoughtful allowlist, and implement these constants properly. Your future self (and your clients) will thank you for the peace of mind that comes with knowing exactly what your WordPress site is doing when you’re not looking.
Need help implementing WordPress HTTP API controls or other security configurations?
Get in touch for a free consultation with one of our WordPress experts and find out how we can implement these security measures for you.




