MailPoet\EmailEditor\Integrations\Core\Renderer\Blocks
Image::cleanup_image_html()
Cleanup image HTML.
Method of the class: Image{}
No Hooks.
Return
null
. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->cleanup_image_html( $content_html ): string;
- $content_html(string) (required)
- Content HTML.
Image::cleanup_image_html() Image::cleanup image html code WC 9.8.1
private function cleanup_image_html( string $content_html ): string { $html = new \WP_HTML_Tag_Processor( $content_html ); if ( $html->next_tag( array( 'tag_name' => 'img' ) ) ) { $html->remove_attribute( 'srcset' ); $html->remove_attribute( 'class' ); } return $html->get_updated_html(); }