Hello everyone! I’m using acf wordpress redactor and in the redactor I can add Media File, but the tag has default options.

How I can remove this options (width, height, classs)
Hi @avearthasz
You would need to add a function to the theme’s function file, something like:
add_filter( 'post_thumbnail_html', 'remove_media_attributes', 10 );
add_filter( 'image_send_to_editor', 'remove_media_attributes', 10 );
function remove_media_attributes( $html ) {
$html = preg_replace( '/(width|height|class)="\d*"\s/', "", $html );
return $html;
}
Code untested!
Thank you! It’s working 🙂 But.. Do you know how to disable this?

ACF resizes my image anyway. My image has 1200×600, but the plugin resized to 300×169.
That looks more like when you select to add an image, you’re not selecting full size but the medium size (which is the default).
Remove the image, re-add it but look to the bottom right corner near the select button and change the image size in the drop down
Yes) Thank you very much!
Sorry, Jarvis. But do you know how to remove default class to my custom? (img)
Example: Default class are “alignnone wp-image”
My class is “news__img”
You can use add_filter( 'get_image_tag_class', '__return_empty_string' );
To remove all classes
You can also use
add_filter('get_image_tag_class','add_custom_image_class');
function add_custom_image_class($class){
$class .= ' news__img';
return $class;
}
To add new classes. This only works when adding images after the code is in place not to existing images.
Alternatively, you could look to use jQuery and do a find/replace on the class
Perfect! Thank you Jarvis