Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

Click to enlarge every image

Switches on WordPress’s built-in lightbox for all Image blocks, so visitors can click any image to see it full size. Editors can still turn it off per image.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Category Posts and editor
  • Tested with WordPress 7.1
PHP
<?php

add_filter(
	'wp_theme_json_data_theme',
	static function ( $theme_json ) {
		return $theme_json->update_with(
			array(
				'version'  => 3,
				'settings' => array(
					'blocks' => array(
						'core/image' => array(
							'lightbox' => array(
								'enabled'      => true,
								'allowEditing' => true,
							),
						),
					),
				),
			)
		);
	}
);

Good to know

For images added with the block editor. Images linked to a page or file keep their link instead.

In these packs

  • Posts and the editor: Make the block editor calmer and give pages excerpts, tags and categories.
  • Images and media: Sharper, lighter images, tidier uploads and a more useful media library.

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.