PHP filters

All of these run when a page is rendered, so they change what visitors get without re-saving any post.

Filter Changes
glidepress_slider_config A slider's Swiper options
glidepress_slider_query_args The posts a Query Slides block shows
glidepress_slider_preload_image The image preloaded for the first slider
glidepress_slider_feature_urls Scripts for add-on features

Slider options

glidepress_slider_config receives the options saved with a slider and the block. Use it for a slower autoplay on one template, no loop on another:

add_filter( 'glidepress_slider_config', function ( array $config, array $block ) {
	if ( is_front_page() && isset( $config['autoplay'] ) ) {
		$config['autoplay']['delay'] = 8000;
	}
	return $config;
}, 10, 2 );

The browser rebuilds the options from an allowlist of what the block offers, so keys the block doesn't know are dropped rather than passed to Swiper. The exception is extensions, which carries options for add-on features.

$block['attrs'] holds the slider's block attributes, including any you add from the editor (Editor extensions).

Query Slides

glidepress_slider_query_args receives the WP_Query arguments behind a Query Slides block, its attributes and the block instance:

add_filter( 'glidepress_slider_query_args', function ( array $args, array $attributes ) {
	$args['meta_key']   = 'featured';
	$args['meta_value'] = '1';
	return $args;
}, 10, 3 );

The arguments arrive already validated: a public post type, publish status, at most 20 posts. Whatever you return is used as is.

The preloaded image

The first slider rendered on a page usually sits at the top, and its first slide's background image is then the largest thing on screen. The plugin prints <link rel="preload" as="image" fetchpriority="high"> for it just before the slider, with a media query when that slide is hidden on some devices.

glidepress_slider_preload_image receives the image URL and the slider block. Return a different URL to preload a smaller image, or '' to preload nothing:

add_filter( 'glidepress_slider_preload_image', function ( string $url, array $slider ) {
	return is_front_page() ? $url : '';
}, 10, 2 );

A slide whose background comes from the Media Library is printed as a responsive <img> instead, which the browser finds by itself; it isn't preloaded.