Today I Learned

How to change JPEG compression rate in WordPress

Our client wants pixel perfect images in his WordPress site. Truth is WordPress is a bit agressive in compressing JPEGs.

WordPress default is 75% compression quality. A higher setting will generate better looking images, to the expense of larger filesize.

Add this to your functions.php file:

// Change JPEG compression rate - 85 is much more reasonable setting
$jpeg_compression = function() { 
    return 85; 

add_filter( 'jpeg_quality', $jpeg_compression );

Advance Custom Fields' textarea newline behaviour in Wordpress

Have you ever wondered why ACF's textarea field adds <br>s in your frontend html instead of a paragraph tag? An this happens in spite of the explicit newline settings on the fields

It turns out this is the default behaviour and it's a rather common pitfall for many ACF newcomers.

Here's the deal:

Hit Enter twice for a paragraph p.
Hit it just once for a regular single line break <br>.