You can use the filter get_image_tag_class
which exists exactly to do what you want:
add_filter('get_image_tag_class','wpse302130_add_image_class');
function wpse302130_add_image_class ($class){
$class .= ' img-fluid';
return $class;
}
Related Posts:
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- Overwrite Parent Theme add_image_size in Child Theme
- Control the srcset much more (not all sizes in it each time)
- Way to store featured image width and height in two separate variables?
- add_image_size() parameter four ($crop = true) is ignored: the_post_thumbnail() returns scaled image(s) instead of hard cropped
- Functions.php Problem
- Redirect to another page using contact form 7? [closed]
- ACF not showing
- How to customize the_archive_title()? Cannot figure out how to change the value it produces [duplicate]
- Check if the image size is available and if not use ‘full’ image size
- Remove Custuomize Sections
- Can we create our own theme’s function.php?
- srcset and custom field get_post_meta and wp_get_attachment_url
- Limit dimensions of “Full” size images
- Define PHP variable from a seperate API if statement
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- Excerpt for pages not showing
- get_pages() Returns Only One Item
- Some questions about how proper add 2 CSS file in a WordPress theme?
- How to hide image-url if no attachment?
- Does size of a theme’s functions.php file matter?
- Functions php shortcode for displaying main menu with no child items
- What are the meta fields for an attachment?
- get_next_posts_link() returns no result despite available posts
- Nav menus all outputting the same links
- PHP 7.1 | Warning: A non-numeric value encountered in
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- How to properly set custom logo size?
- Add attribute only to first image of every post via functions.php
- How to insert class in each list of categories?
- I can’t add CSS with functions.php
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- Need to convert image url to a Base_64 data url with wordpress function..
- How to Add Shortcode to html img code?
- Getting the teaser text without overriding global variables
- Combine two active_callbacks into one on theme customizer
- WP Customizer API loaded into functions.php
- call_user_func_array() expects parameter 1 to be a valid callback, function
- why can’t i add front.css to my frontpage.php
- How to add a new image size and apply it to posts only?
- Function to insert missing image size attributes into img tags
- “options.php” not found
- How to store a number (coming from cookie) into query vars for later usage in other filters?
- Image Crop Not Working
- Is this an acceptable practice for WordPress theme development?
- What is the correct way to include my new functions and scripts in WordPress?
- wp_nav_menu work in functions.php but not in the theme
- Use existing image sizes for WooCommerce
- Problem in using Customizer
- Rewrite Question Mark in Post Template with URL Parameter for clean URLs
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- contact form in template with jquery,validate and ajax
- Why a SlideShow (made using JQuery FlexSlider) can’t work if I load it form functions.php but work if I load it from my footer.php file? [closed]
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- Retrieve First Image Function
- Custom Image Size in Insert Media
- Featured Image keeps cropping
- Prevent creating multiple image resizes in twentytwelve template
- Conditional function for excluding first image from content, not working
- Using add_image_size in functions.php to get original uploaded file
- get_image_tag() html output : empty src attribute
- How to make excerpt image be full size instead of thumbnail?
- Need To Resize Images Exactly Without Losing Image Details
- Woocommerce Variable Product Dropdown for Custom Shop Template
- Custom image sizes showing in Classic Editor only when upladed directly to post
- how can I change all wordpress media file url to custom cdn url?
- Different image using srcset function
- How to fix Function create_function() is deprecated in / themes
- Exclude specific post from query
- Advanced method to control cache of enqueued style/script
- Is it possible to limit number of files a non-admin user can upload via the WordPress media library?
- Auto delete content in specific folder inside media library
- How to change images url in function.php?
- WordPress wp_dequeue_script remove all other scripts
- How to update an image attachment’s alt text from a custom field when saving a post?
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- Class parameter in get_avatar args doesn’t get added to output
- large image size of 1440×1440 not pulling 2x of 2880×2880 image
- Is_Page doesnt detect my page
- Test CDN link from function.php or wp_enqueue_script/style?
- How to customize archive widget only for cpt?
- Can You Set A Minimum Image Dimension For Resizing Images?
- wp_title() return random number
- blank page with wp_get_attachment
- Why does echo on functions.php not yield result in source code?
- (Divi): How to make WordPress load images of specific size for Blurb modules on given page with a funciton?
- Images with overlay
- How to offset main query without affecting other queries and backend
- Add meta data in head from theme
- what is `get_section()` and how to use it?
- How to wrap image tag into div for post only?
- Featured image on archive page based on post type
- Remove External Links from WordPress posts Using add_filter() in Theme functions.php
- Printing medium sized image
- How to retrieve image IDs from shortcode content?
- HowTo: Add wrapper to columns shortcode?
- restrict uploaded image size and fixed image display size
- Why am I losing image quality on my site?
- Replace image attributes for lazyload plugin on image elements with specific class
- How to create admin ajax function for my contact form