benecaster_show_header_artwork_url
Filters the show artwork URL used in show/header.php.
Return a URL string. Cast with (string) and output through esc_url(), which silently drops a disallowed protocol — a javascript: URL becomes an empty attribute rather than an error.
⚠ Returning an empty string SHORT-CIRCUITS the artwork block entirely (if ( $artwork_url !== '' )), so '' is the supported way to suppress the image. Anything non-empty but unreachable renders a broken image instead; this filter does not validate that the URL resolves.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$url |
string |
— | Show artwork URL |
$show_id |
int |
— | ID of the show |
Returns:
string
Example
add_filter( 'benecaster_show_header_artwork_url', function( $url, $show_id ) {
// Serve a WebP variant of the artwork when the browser supports it.
if ( isset( $_SERVER['HTTP_ACCEPT'] ) && str_contains( $_SERVER['HTTP_ACCEPT'], 'image/webp' ) ) {
$webp = get_post_meta( $show_id, '_show_artwork_webp_url', true );
if ( $webp ) {
return $webp;
}
}
return $url;
}, 10, 2 );
Affects
- show/header.php template part