wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Gallery shortcode remove css

wordpress snippet

Adding this PHP code to your function.php will remove the CSS wordpress adds when using the gallery shortcode.

snippet :  PHPcopy
         add_filter('gallery_style', create_function('$a', 'return "<div class=\'gallery\'>";'));

Did you like this post? If so please share it with your friends. Thanks!

  • http://twitter.com/eduplessis Edouard Duplessis

    more easy

    add_filter(‘use_default_gallery_style’, FALSE);

    • http://wpsnipp.com Kevin Chard

      Ahhh slick thanks.

    • Khaled Attia

      Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in WORDPRESS_PATHwp-includesplugin.php on line 166

      • Khaled Attia

        This work
        add_filter(‘use_default_gallery_style’, create_function(”,’return FALSE;’));

        • Rodrigo

          add_filter(‘use_default_gallery_style’, ‘__return_false’);
          wordpress has his own function for this cases, don’t need hack with lambda-style functions