WordPress Tweaks

Wiki.TerraBase.info
Revision as of 08:52, 15 February 2022 by Root (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Some potential gains by disabling unnecessary or unneeded functionality are addressed here: https://design2seo.com/blog/web-development/wordpress/disabling-unused-wordpress-features/But use caution. A plugin that provides a useful function may depend on a feature here. Heartbeat is a good example of something a lot of plugins use behind the scenes. It would be nice

Change the allowable image size put in an HTML SRCSET Attribute size (of course 16384 is a fairly large screen) setting into a Child Theme's functions.php file;

function new_srcset_max($max_width) {
    return 16384;
}

add_filter('max_srcset_image_width', 'new_srcset_max');

When WordPress creates "Thumbnails" (AKA Alternative Image Sizes (AIS(s)), the default quality compression is set to 85% (supposedly). The below setting in a Child Theme's functions.php file preserves 100% quality;

// Old Syntax
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );

OR

// New Syntax
function JPEG_Quality() {
	return 100;
}
add_filter('jpeg_quality', 'JPEG_Quality');

The first method above seems to be deprecated as of PHP 7.2, so the 'modern' syntax is the second one.