Exclusion tactics not working on
-
The plugin is working well for me except for exclusion options I used are now broken.
I have animated pngs that I keep from being replaced because the replacement versions are not animated (animated text beginning with “We Are”).
I was using a filter on webpc_attachment_paths with a naming convention, but this stopped working with the latest plugin update. After reviewing your FAQs I implemented a solution with enumerated file names.
Both solutions just do not work to exclude specific images from being replaced – in my <picture/> element – and this used to work.
Here are my functions for exclusion:
add_filter('webpc_attachment_paths', function($paths) { $suffix = '-nowebp'; foreach ($paths as $index => $path) { if (!preg_match('/(.*?)' . $suffix . '((-(.*))?)\.(jpe?g|png|gif)/', basename($path))) continue; unset($paths[$index]); } return $paths; }); add_filter( 'webpc_supported_source_file', function( bool $status, string $file_name, string $server_path ): bool { $excluded_files = [ 'Overit-Website_Text_Animation-APNG_opt-tinypng-nowebp.png', 'Overit-Website_Text_Animation-APNG_420px_opt-tinypng-nowebp.png', ]; if ( ! $status || in_array( $file_name, $excluded_files ) ) { return false; } return $status; }, 10, 3 );
The page I need help with: [log in to see the link]
- The topic ‘Exclusion tactics not working on’ is closed to new replies.