Remove Unused CSS but keep img selectors
-
I want to set ‘remove_unused_css’ to ‘always’ for the style sanitizer, but I also don’t want it to change img selectors or remove them. I’ve tried this so far:
add_filter( 'amp_content_sanitizers', function( $sanitizers, $post ) { $sanitizers['AMP_Style_Sanitizer'] = array( 'remove_unused_rules' => 'always', 'dynamic_element_selectors' => array( 'img' ) ); return $sanitizers; }, 10, 2 );
This does remove unused CSS but still messes with the img selectors.
Is there a way I can get the style sanitizer to ignore img selectors entirely?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Remove Unused CSS but keep img selectors’ is closed to new replies.