apply_filters ( 'jetpack_photon_pre_args', array $args, string $image_url, string $scheme )

Filter the original Photon image parameters before Photon is applied to an image.

Source file: functions.photon.php

View in GitHub



(array) Array of Photon arguments.


(string) Image URL.


(string) Image scheme. Default to null.


Since: Jetpack 1.9.0


You can use this filter to change the Photon parameters used for images on your site, like so:

function jeherve_custom_photon( $args ) {
    $args['quality'] = 80;
    $args['strip']   = 'all';
    $args['filter']  = 'grayscale';
    return $args;
add_filter( 'jetpack_photon_pre_args', 'jeherve_custom_photon' );

Have a note to contribute?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


  1. wolfincage says:

    How would we use it for only images inside a post?

  2. khurramar says:

    Just added this script in my plugin and it works great. However it also converted the URLs in “a” tag. For example an image wrapped into an anchor “a” tag for opening full size version of the image. In result, when a query string is added at the end of the image link, the lightbox stopped working.

    Can we restrict this to apply to only tags and not other tags?

  3. Thomas says:

    What are all the Photon arguments? I see three in the code above (quality, strip, filter) but are there more?