Skip to content

activitypub_cache_is_safe_url

github-actions[bot] edited this page Feb 25, 2026 · 2 revisions

Filters whether a URL passes safety validation.

By default, uses wp_http_validate_url() which prevents SSRF attacks by blocking private IPs and localhost. This filter allows overriding for testing or custom validation needs.

or null to use default wp_http_validate_url() check.

Auto-generated Example

/**
 * Filters whether a URL passes safety validation.
 * 
 * By default, uses wp_http_validate_url() which prevents SSRF attacks
 * by blocking private IPs and localhost. This filter allows overriding
 * for testing or custom validation needs.
 * 
 * 
 * or null to use default wp_http_validate_url() check.
 *
 * @param bool   $is_safe 
 * @param string $url 
 * @return bool The filtered value.
 */
function my_activitypub_cache_is_safe_url_callback( bool $is_safe = null, string $url ) {
    // Your code here.
    return null;
}
add_filter( 'activitypub_cache_is_safe_url', 'my_activitypub_cache_is_safe_url_callback', 10, 2 );

Parameters

  • bool|null $is_safe Whether the URL is safe. Return true/false to override,
  • string $url The URL being validated.

Files

\apply_filters( 'activitypub_cache_is_safe_url', null, $url )

← All Hooks

Users

Developers

Clone this wiki locally