Difference between revisions of "WordPress Tweaks"
(Created page with "Disabling unnecessary or unneeded functionality: https://design2seo.com/blog/web-development/wordpress/disabling-unused-wordpress-features/ Change the allowable image upload size in a Child Theme's functions.php file;<syntaxhighlight lang="text"> function new_srcset_max($max_width) { return 16384; } add_filter('max_srcset_image_width', 'new_srcset_max'); </syntaxhighlight>When WordPress creates "Thumbnails" (AKA Alternative Image Sizes (AIS(s)), the default quality...") |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
Some potential gains by disabling unnecessary or unneeded functionality are addressed here: https://design2seo.com/blog/web-development/wordpress/disabling-unused-wordpress-features/<nowiki/>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 | 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;<syntaxhighlight lang="text"> | ||
function new_srcset_max($max_width) { | function new_srcset_max($max_width) { | ||
return 16384; | return 16384; | ||
Line 8: | Line 8: | ||
add_filter('max_srcset_image_width', 'new_srcset_max'); | add_filter('max_srcset_image_width', 'new_srcset_max'); | ||
</syntaxhighlight>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;<syntaxhighlight lang="text"> | </syntaxhighlight>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;<syntaxhighlight lang="text"> | ||
// Old Syntax | |||
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) ); | add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) ); | ||
</syntaxhighlight> | |||
OR | |||
// New Syntax | |||
function JPEG_Quality() { | |||
return 100; | |||
} | |||
add_filter('jpeg_quality', 'JPEG_Quality'); | |||
</syntaxhighlight>The first method above seems to be deprecated as of PHP 7.2, so the 'modern' syntax is the second one. |
Latest revision as of 08:52, 15 February 2022
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.