X

How to Remove Inline Style From Gallery Shortcode

Snippets by IsItWP

By default, when you add an image gallery shortcode in WordPress, it’ll automatically include some inline CSS for the gallery. If you want to customize or add your own styling for the gallery, then you need to disable the default inline CSS.

Instructions: Add the following code to the functions.php file of your WordPress theme.

add_filter( 'use_default_gallery_style', '__return_false' );

You may also enjoy using custom CSS for WordPress editor.

Comments   Leave a Reply

  1. Thank you for your explanation. But is there any plugin to help eliminate inline CSS

    1. Sadly, this will depend on the theme, content and CSS in the customizer. For any theme inline CSS, most likely the best option would be to edit the theme.

  2. Thanks muchly, been trying to get rid of that for a while!

    1.  no problem glad that I could help

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!