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
- Image alt tag is showing post title instead of Alt Text
- php syntax : [ && ] between commands [closed]
- Need to put a script above tag in header.php – WP 5.7.1
- Sending a custom form data in email through WP Mail Function
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Isotope Drop Down Categories Filter Function
- How to use array in function to get only value I want
- What is the best way to define constant options for a theme?
- How to add PHP code in functions.php wordpress
- trying to get wp_get_attachment_url to output clickable link
- add_filter function concatenate string and locate_template function
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- get_page_templates only return templates with “home” in the filename
- Nav-Menu not showing up
- Show different website layout if no sidebar added
- How to Make Thumbnail of Post Stay Animated
- get_template_part function and add images
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- How to pass hook variable to function?
- Migrating site, only header shows
- remove specificly the last tag in all posts
- Let current user know pending posts counts using wp_query
- How to check post meta isset or not empty during publish/save post?
- how to changes mobile menu toggle breakpoint in WordPress
- Get page permalink in contact form
- How to display already created menus via php?
- Grabbing Image name From Product Image Gallery
- How to hide a child category and show his parent category
- Prepend to all image URLs with PHP, only for mobile devices
- Gutenberg block don’t save rich text content
- remove_action from parent theme using child theme functions.php
- Cant get blog name with get_option
- How to change this ajax function to submit to the default wordpress content area instead of the custom field ‘seller notes’?
- Remove span tags from WooCommerce Downloads page
- How to add typehints to function in functions.php when argument is an object?
- Pagination 404 error(I have refreshed the permalinks and tried several previous options)
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Custom Post type Ajax search results
- Customizing the output of the archive and category widget without altering the original behavior of the widget
- Get posts associated with media attachment
- How to set up an auto delete post?
- Display a post based on its metabox selection
- apply_filters() function
- Calling the Next category link on an archive page – WordPress
- Using tag to output text in Genesis?
- Target all images that are not the first attachment
- images in wordpress themes
- Merging two excerpt functions to work with conditions
- wp wp_register_script function results type parameter missing
- Correct Syntax for uploading files to custom directory in WordPress
- How do I return an image from a script
- php “use” not working in template [closed]
- display php code in header using wp_head()
- Sorting Problem
- How to add different menu items on different menus?
- Using Featured Image as Hero Background in Word Press
- Function for Post Creation plugin for Gravity Forms
- Modify the permalink structure for a specific category
- Can I redirect media urls (not attachment pages) to the post parent?