Skip to content

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).

Auto-generated Example

/**
 * 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 );

Parameters

  • bool $allow Whether to allow the non-public host. Default false.
  • string $host The host being resolved.

Files

\apply_filters( 'activitypub_allow_non_public_host', false, $host )

← All Hooks

Users

Developers

Clone this wiki locally