# Disable the Image Lightbox Option

> Removes the "Expand on click" lightbox setting from Image blocks and turns the lightbox off.

- Type: PHP
- Runs: Run everywhere
- Category: [Disable Features](https://wpide.com/library/category/disable-features/)
- Tags: disable, images, blocks
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/disable-image-lightbox/

## Code

```php
add_filter( 'wp_theme_json_data_theme', function ( $theme_json ) {
    return $theme_json->update_with( array(
        'version'  => class_exists( 'WP_Theme_JSON' ) && defined( 'WP_Theme_JSON::LATEST_SCHEMA' ) ? WP_Theme_JSON::LATEST_SCHEMA : 3,
        'settings' => array(
            'blocks' => array(
                'core/image' => array(
                    'lightbox' => array(
                        'allowEditing' => false,
                        'enabled'      => false,
                    ),
                ),
            ),
        ),
    ) );
} );
```

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Disable the Image Lightbox Option" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
