Skip to content

Instantly share code, notes, and snippets.

View nosilver4u's full-sized avatar

Shane Bishop nosilver4u

View GitHub Profile
@nosilver4u
nosilver4u / ewwwio-force-resize
Created January 20, 2023 16:34
Force EWWW IO to obey maximum image dimensions regardless of file size.
<?php
/*
Plugin Name: EWWW IO Force Resize
Description: Skips the file size check after resizing the full-size image.
Version: 1.0.0
*/
add_filter( 'ewww_image_optimizer_resize_filesize_ignore', '__return_true' );
@nosilver4u
nosilver4u / easyio-fit-override.php
Last active January 18, 2023 18:52
Force usage of fit vs. override when height/width attributes are not matching
<?php
/*
Plugin Name: Easy IO Fit Override
Version: 1.0.0
*/
add_filter( 'exactdn_post_image_args', 'easyio_force_fit_scale' );
function easyio_force_fit_scale( $args ) {
if ( ! empty( $args['resize'] ) ) {
$args['fit'] = $args['resize'];
@nosilver4u
nosilver4u / imsanity-hard-crop.php
Created December 22, 2022 18:01
Change Imsanity (and EWWW IO) to hard crop instead of scale
<?php
/*
Plugin Name: Imsanity Hard Crop
Description: Enables the Imsanity and EWWW IO cropping filters.
Version: 1.0.0
*/
add_filter( 'imsanity_crop_image', '__return_true' );
add_filter( 'ewww_image_optimizer_crop_image', '__return_true' );
@nosilver4u
nosilver4u / frt-tweaks.php
Last active October 28, 2024 13:08
Force Regenerate Thumbnails Tweaks
<?php
/*
Plugin Name: Force Regenerate Thumbnails Tweaks
Version: 1.0.0
*/
// NOTE: This plugin will do nothing without alterations. Uncomment the add_filter() lines for the filters you wish to use.
// If necessary, edit them to your needs. Some filters simply turn things on/off by returning a true or false.
// For such filters, using WordPress' built-in __return_true() or __return_false() functions will work just fine, unless
// you wish to conditionally enable/disable a feature.
@nosilver4u
nosilver4u / easyio-allow-ajax.php
Created July 22, 2022 14:49
Easy IO Allow AJAX
<?php
/*
Plugin Name: Easy IO Allow AJAX
Version: 1.0.0
*/
// Overrides for admin-ajax images.
add_filter( 'exactdn_admin_allow_image_downsize', 'easyio_allow_admin_ajax_images', 10, 2 );
add_filter( 'exactdn_admin_allow_image_srcset', 'easyio_allow_admin_ajax_images', 10, 2 );
add_filter( 'exactdn_admin_allow_plugin_url', 'easyio_allow_admin_ajax_images', 10, 2 );
@nosilver4u
nosilver4u / swis-prehint-exclusions.php
Created June 14, 2022 17:04
SWIS Exclude Domain(s) from Prefetch/Preconnect
<?php
/*
Plugin Name: SWIS Pre-Hint Exclusions
Version: 1.0.0
*/
// This example uses the same function for both hooks.
add_filter( 'swis_skip_preconnect', 'my_swis_prehint_exclusions', 10, 2 );
add_filter( 'swis_skip_prefetch', 'my_swis_prehint_exclusions', 10, 2 );
function my_swis_prehint_exclusions( $skip, $domain ) {
@nosilver4u
nosilver4u / ewwwio-adjust-sharpening.php
Last active March 23, 2023 23:48
EWWW IO adjust Sharpening functions/params.
<?php
/*
Plugin Name: EWWW IO Adjust Sharpening
Version: 1.0.0
*/
/*
* Valid options:
* 'FILTER_POINT',
* 'FILTER_BOX',
@nosilver4u
nosilver4u / easyio-skip-feeds.php
Last active March 10, 2022 18:03
Prevent Easy IO from parsing RSS feed
<?php
/*
Plugin Name: Easy IO Feed Bypass
Version: 1.0.0
*/
add_filter( 'exactdn_skip_page', 'easyio_feed_bypass', 10, 2 );
function easyio_feed_bypass( $bypass, $uri ) {
if ( false !== strpos( $uri, '/feed/' ) ) {
return true;
@nosilver4u
nosilver4u / easyio-skip-gif-resizing.php
Created February 16, 2022 16:20
Prevent resizing of GIF images by Easy IO
<?php
/*
Plugin Name: Easy IO GIF Skipper
Version: 1.0.0
*/
add_filter( 'exactdn_pre_args', 'easyio_skip_gif_resizing', 10, 2 );
function easyio_skip_gif_resizing( $args, $image_url ) {
if ( strpos( $image_url, '.gif' ) ) {
return array();
@nosilver4u
nosilver4u / swis-critical-css-api-override.php
Last active January 4, 2022 01:45
Force the inclusion of CSS for certain elements within the Critical CSS function of SWIS Performance
<?php
/*
Plugin Name: SWIS Critical CSS Override
Version: 1.0.0
*/
add_filter( 'swis_generate_css_post_fields', 'swis_ccss_override_post_fields' );
function swis_ccss_override_post_fields( $fields ) {
if ( is_array( $fields ) ) {
$fields['forceInclude'] = array(