You could do like this:
function image_tag_class($class) {
$class .= ' my-custom-class';
return $class;
}
add_filter('get_image_tag_class', 'image_tag_class' );
in case you wanna know more about actions and hooks.
Difference Between Filter and Action Hooks?
add_filter
add_action
Related Posts:
- How do I change/modify the_post_thumbnail(); html output?
- How to draw media details for Isotope gallery using Photoswipe
- How to register images uploaded via FTP in media library?
- Adding Featured Image to Post programatically
- Add custom image sizes to media uploader
- Add custom field to attachments in a specific category
- Conditional Statement – check if post has an attachment image
- Get a Page’s attachments in Gallery order
- Use Timber/Twig to pull an image by image ID [closed]
- Using wp_get_image_editor in a standalone script
- Change logo based on incoming domain
- page template for attachement page?
- Convert all images to PNG on file upload
- How to get specific image in media library with php
- Set the background to a default image if there isn’t a specified “featured image”
- How to control WordPress image metadata (using Imagick)?
- Scrape external webpage for first image and add it to new post
- Which PHP page is the Default Posts Page
- Else/If Statement to Display Photo Descriptions
- Image rotation issue (horizontal picture uploading as vertical) — Exif issue?
- Attaching images to posts manually (i.e. with custom code, without the use of an API)
- Adding a ‘style=’ bit to image_send_to_editor output
- Convert all uploaded PNG files to PNG-8 format
- Retrieve alt text by referencing the img src
- not outputting medium size image URL
- How to use data URL in WordPress?
- Extra editor on top of default in Custom Post Type
- Get list of posts from attachment
- remove public static function wp_link_dialog()
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- Retrieving specific images from Media Library
- How do I routinely extract the thumbnail of the most recent post?
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- Save the outputted image into the Media Library, with a different filename and extension
- add if statement to the featured image
- Remove default Image Sizes
- Understanding responsive imagery
- WooCommerce: write featured image dimensions to custom fields in product’
- Generate and upload screenshot as featured image for user-submitted post
- WordPress Theme file editor – error with sleep() php function
- Image alt tag is showing post title instead of Alt Text
- Shortcode content filter?
- How do I let users upload files to a chosen location?
- Change the URL of an image from wp_get_attachment_image_src except in the frontpage
- Get different images for mobile and desktop with php, advanced custom fields without using js and ajax
- Randomise upload filenames (or another solution to hide the original image URL from theft?)
- How do I display a user’s previous orders as a select box option on a product?
- Using file_get_contents with Gravity Forms uploads folder to create images in the media library returning false
- allow subscribers to see private posts without plug in
- Replace word in “the_content” only for index.php
- How do you add customer capability after Woocommerce purchase?
- Function set default image when image not present
- Custom location for attached images
- hover image appears below placeholder instead of overlayed
- WooCommerce – Reset quantity input field when variation changes
- Query all posts of a custom taxonomy term
- get current product name in functions.php
- Get first URL from post content
- Setting custom canonical urls
- Handling Body class based on Template
- Trigger popup in a php if/else statement
- Setting a cookie upon specific URL visit
- Get_avatar filter?
- Can’t get page content in WordPress
- WordPress child theme fails to override parent navigation menu in /inc/structure/header.php
- Way to querry data (tags) from a wordpress database?
- get post based on category chosen in drop down – The ajax method
- Adding Default Settings to Theme My Login plugin
- Image as Sales Badge
- how to make separate field in wordpress user_data_
- Function not working at one place
- jQuery not defined
- Displaying the Month and Year that a page was Created?
- Changing custom logo link
- Add a class to the anchor tag on HTML5 gallery
- Conditional Header in wordpress
- Remove meta description on certain pages
- add_image_size for header_image
- Menu — How to add “current-menu-grand-ancestor” css class
- Use menu link or onClick to set a variable
- Swapping wp_dropdown_categories function with wp_category_checklist
- functions.php is being included twice, creating PHP fatal errors
- Add custom url to featured image
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Automatically remove a canceled order in Woocommerce
- Get image’s size name from it’s dimension
- Display fields as values in array from external SQL DB
- Only Show Link If div Exists
- Cannot display or echo alt text on featured image
- How to put a variable in a instance in the widget
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Trying to establish connection to External Database
- WordPress Search Results for Multiple Post Types
- Recent posts with featured image or fallback image with permalink
- add_action shortcut?
- Passing the custom field values in the wp_get_current_user array function
- Best practice for migration friendly images in posts/pages?
- Using fwrite() and “a” appends multiple times instead of once
- How to output a PHP file values by shortcode?