-
Notifications
You must be signed in to change notification settings - Fork 91
activitypub_allow_non_public_host
github-actions[bot] edited this page Aug 3, 2026
·
4 revisions
Filters whether a non-public host may be used.
Returning true skips this function's private/reserved-range validation and returns the resolved address as is, for sites that federate over a private network or intranet. A host that does not resolve at all is still rejected.
Note: Callers that fetch through WordPress' safe HTTP APIs (wp_safe_remote_get()/post()) are still subject to core's own loopback/RFC1918 rejection outside its same-host exception. Re-enabling those ranges additionally requires filtering WordPress core (e.g. http_request_reject_unsafe_urls).
/**
* Filters whether a non-public host may be used.
*
* Returning true skips this function's private/reserved-range validation and returns the resolved
* address as is, for sites that federate over a private network or intranet. A host that does not
* resolve at all is still rejected.
*
* Note: Callers that fetch through WordPress' safe HTTP APIs (wp_safe_remote_get()/post())
* are still subject to core's own loopback/RFC1918 rejection outside its same-host exception.
* Re-enabling those ranges additionally requires filtering WordPress core (e.g.
* http_request_reject_unsafe_urls).
*
* @param bool $allow
* @param string $host
* @return bool The filtered value.
*/
function my_activitypub_allow_non_public_host_callback( bool $allow, string $host ) {
// Your code here.
return $allow;
}
add_filter( 'activitypub_allow_non_public_host', 'my_activitypub_allow_non_public_host_callback', 10, 2 );-
bool$allowWhether to allow the non-public host. Default false. -
string$hostThe host being resolved.
\apply_filters( 'activitypub_allow_non_public_host', false, $host )Follow @activitypub.blog@activitypub.blog for updates and news.