WordPress filter hook · part of WordPress core

use_default_gallery_style

A WordPress core filter that 26 plugins also fire themselves, running on 120K+ sites between them.

“Filters whether to print default gallery styles.”

How to use use_default_gallery_style

It's a filter: your callback receives the value, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'use_default_gallery_style', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Argument names come from Media Library Assistant's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

This hook is fired by WordPress core too. Official reference on developer.wordpress.org →

26 plugins that fire use_default_gallery_style

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. Media Library Assistant icon Media Library Assistant70,000+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) includes/class-mla-shortcode-support.php:1475
  2. GeoDirectory icon GeoDirectory10,000+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) includes/class-geodir-elementor.php:878
  3. Related Posts by Taxonomy icon Related Posts by Taxonomy10,000+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) includes/gallery.php:194
  4. WP Multilang icon WP Multilang10,000+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) includes/wpm-template-functions.php:314
  5. SportsPress icon SportsPress10,000+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) templates/player-gallery.php:93
  6. WP Media Category Management icon WP Media Category Management6,000+ installs apply_filters( 'use_default_gallery_style', !$html5 ) include/shortcode/class-WP_MCM_Shortcode.php:384
  7. Image Carousel icon Image Carousel1,000+ installs apply_filters( 'use_default_gallery_style', true ) inc/functions/icp-functions.php:271
  8. Simple WP Retina icon Simple WP Retina1,000+ installs apply_filters( 'use_default_gallery_style', true ) simple-wp-retina.php:269
  9. RPS Image Gallery icon RPS Image Gallery700+ installs apply_filters( 'use_default_gallery_style', ( $this->getFormat() === 'legacy' ) ? true : false ) dependencies/rpsslideshow/display/GalleryView.php:367
  10. Tribulant Gallery Voting icon Tribulant Gallery Voting300+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) index.php:505
  11. Media Categories icon Media Categories300+ installs apply_filters( 'use_default_gallery_style', true ) media-categories.php:337
  12. Gallery Image Captions (GIC) icon Gallery Image Captions (GIC)100+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) gallery-image-captions.php:259
  13. Paginated Gallery icon Paginated Gallery100+ installs apply_filters( 'use_default_gallery_style', true ) paginated-gallery.php:144
  14. Simple Galleria for WordPress icon Simple Galleria for WordPress90+ installs apply_filters( 'use_default_gallery_style', true ) inc/class.shortcode.php:105
  15. Post gallery slider icon Post gallery slider60+ installs apply_filters( 'use_default_gallery_style', true ) templates/gallery.php:3
  16. WP Gallery Download Links icon WP Gallery Download Links50+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) wp-gallery-download-links.php:142
  17. PhotoPress icon PhotoPress50+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) photopress-gallery.php:152
  18. WP iSell Photo icon WP iSell Photo40+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) wp-iSell-photo.php:287
  19. Xpand Image Gallery icon Xpand Image Gallery30+ installs apply_filters( 'use_default_gallery_style', true ) XpandGalleryLite.php:207
  20. Rajce embed icon Rajce embed30+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) rajce-embed.php:266
  21. PrettyGallery icon PrettyGallery20+ installs apply_filters( 'use_default_gallery_style', true ) prettygallery.php:133
  22. Sell Photo icon Sell Photo10+ installs apply_filters( 'use_default_gallery_style', ! $html5 ) main.php:375
  23. Gallery Just Better icon Gallery Just Better10+ installs apply_filters( 'use_default_gallery_style', true ) galleryjustbetter.php:112
  24. Mega-giga-gallery-slider icon Mega-giga-gallery-slider10+ installs apply_filters( 'use_default_gallery_style', !$html5 ) mega-giga-gallery-slider.php:408
  25. Picasso icon Picasso10+ installs apply_filters( 'use_default_gallery_style', true ) picasso.php:106
  26. Create Custom Hover Effects On Images WP Plugins icon Create Custom Hover Effects On Images WP PluginsFewer than 10 installs apply_filters( 'use_default_gallery_style', ! $html5 ) CreateCustomHoverEffectsOnImages.php:191

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.