Skip to content

Instantly share code, notes, and snippets.

@raewrites
Created January 28, 2015 04:43
Show Gist options
  • Save raewrites/073d11de7417808f1c0e to your computer and use it in GitHub Desktop.
Save raewrites/073d11de7417808f1c0e to your computer and use it in GitHub Desktop.
Full Image Quality
add_filter( 'jpeg_quality', create_function( '', 'return 100;' ) );
@gomediapt
Copy link

debug.log is showing that some code is obsolete, is that true?

[11-Nov-2015 19:15:48] PHP Notice: The constructor method called for WP_Widget is obsolet since version 4.3.0! Use

__construct()
insted. in /chroot/home/mydomaincom/mydomain.com/html/wp-includes/functions.php on line 3457

@tomjn
Copy link

tomjn commented Aug 3, 2017

That will trigger warnings in PHPCS PHPMD and other tools because of create_function. This would be more secure, and easier to understand as:

add_filter( 'jpeg_quality', function() {
    return 100;
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment