Title: gallery_style
Published: April 25, 2014
Last modified: August 20, 2026

---

# apply_filters( ‘gallery_style’, string $gallery_style )

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#changelog)

Filters the gallery shortcode’s default CSS styles and opening HTML div container.

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#description)󠁿

To remove the CSS entirely, use the `use_default_gallery_style` filter instead:

    ```php
    add_filter( 'use_default_gallery_style', '__return_false' );
    ```

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#parameters)󠁿

 `$gallery_style`string

Default CSS styles and opening HTML div container for the gallery shortcode output.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#source)󠁿

    ```php
    $output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/media.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/media.php#L3033)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/media.php#L3033-L3033)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#related)󠁿

| Used by | Description | 
| [gallery_shortcode()](https://developer.wordpress.org/reference/functions/gallery_shortcode/)`wp-includes/media.php` |

Builds the Gallery shortcode output.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/gallery_style/?output_format=md#changelog)󠁿

| Version | Description | 
| [7.0.0](https://developer.wordpress.org/reference/since/7.0.0/) | Removed the `type` attribute for any theme. | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Removed the `type` attribute for `style` tags when the theme supports HTML5 style, and changed the quotes from single to double for other themes. | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Added classes for number of columns and size to opening div. | 
| [2.5.0](https://developer.wordpress.org/reference/since/2.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fgallery_style%2F)
before being able to contribute a note or feedback.