WordPress filter hook · part of WordPress core
http_allowed_safe_ports
A WordPress core filter that 13 plugins also fire themselves, running on 1.1M+ sites between them.
“This filter is documented in wp-includes/http.php”
How to use http_allowed_safe_ports
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'http_allowed_safe_ports', function( $value, $host, $url ) {
// Change $value here.
return $value;
}, 10, 3 );Argument names come from Limit Login Attempts Security's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
13 plugins that fire http_allowed_safe_ports
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Limit Login Attempts Security1+ million installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )core/http/Http.php:285 -
Web Stories50,000+ installs
apply_filters( 'http_allowed_safe_ports', [ 80, 443, 8080 ], $host, $url )includes/REST_API/Hotlinking_Controller.php:813 -
Bit Form10,000+ installs
apply_filters( 'http_allowed_safe_ports', [80, 443, 8080], $host, $url )backend/app/Integrations/WebHooks/WebHooksHandler.php:215 -
Agent Abilities for MCP1,000+ installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )includes/abilities/media.php:1265 -
SScribe Export Site Pages20+ installs
apply_filters( 'http_allowed_safe_ports', self::SAFE_PORTS, $host, $url )includes/class-sscribe-outbound-guard.php:68 -
TSO Link Inspector10+ installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, (string) $url )includes/class-tso-lc-http.php:2054 -
Webhook Actions10+ installs
apply_filters( 'http_allowed_safe_ports', [80, 443, 8080], '', '' )src/Controllers/AdminController.php:181 -
PerfLocaleFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', [ 80, 443, 8080 ], $parts['host'], $url )src/Webhook/Delivery.php:105 -
BuildWithHumza Broken Link CheckerFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )includes/class-bwh-blc-checker.php:396 -
PostludeFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $parts['host'], $configured )includes/class-api-client.php:361 -
Soapbox for BlyggerFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )src/Mentions/Address.php:155 -
Quilio Link CheckerFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )src/Checker/Checker.php:267 -
Cybexsoft SMTPFewer than 10 installs
apply_filters( 'http_allowed_safe_ports', array( 80, 443, 8080 ), $host, $url )includes/class-cybex-smtp-alert-channels.php:101
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.