Remove Inline Style Of WordPress Gallery Shortcode

Today I’ll give you a small tip for the WordPress Gallery. With version 3.1 of WordPress it is possible to replace the inline style of the core, it’s done easily with a Filter-Hook. Use this and include your custom style with the Theme in your frontend; no Plugins, CSS or functions in your Theme for this required – easy, but it works and this is the greatest part of WordPress – Hooks for everyone, everywhere

add_filter( 'use_default_gallery_style', '__return_false' );

If you don`t understand the function __return_false() of the WP Core, please read our post for this function.





4 responses to “Remove Inline Style Of WordPress Gallery Shortcode”

  1. Mike Avatar

    I just need to find a way to get the rid of the inserted clear:both line breaks that works now.

  2. […] first” werden vier wichtige Faktoren formuliert, vier Ws in Anlehnung an den Journalismus. WPEngineer stellt einen kleinen Filter vor, der Inline-Styles in der WordPress-Gallery […]

  3. Rilwis Avatar

    A note when using this technique is that we should implement our own CSS rules. And it’s very helpful if we can list the default classes of gallery. I wrote a same post about this here.

  4. Frank Avatar

    @Rilwis: thanks, great ressource with more informations