Skip an Image with Site Accelerator (Formerly Photon)

Once you activate the Site Accelerator module, it will automatically cache and serve all images you’ve added to your posts and pages that have been uploaded to your site.

You can exclude a specific image or an entire page from Site Accelerator easily.

To exclude an entire post or page from using Site Accelerator, you can modify this snippet to fit your needs and add it to your theme’s functions.php or a core functionality plugin:

function no_photon_by_page() {
if ( is_page( 2 ) ) {
add_filter( 'jetpack_photon_skip_image', '__return_true');
}
}

add_action('wp', 'no_photon_by_page');

In this example, Site Accelerator won’t be used on the page with the ID of 2, but you can use any of the WordPress Conditional Functions.

If you’d like to exclude an image from being cached and served by Site Accelerator, you can add the following code to your theme’s functions.php file:

function my_photon_exception( $val, $src, $tag ) {
if ( $src == 'YOUR_IMAGE_URL' ) {
return true;
}
return $val;
}
add_filter( 'jetpack_photon_skip_image', 'my_photon_exception', 10, 3 );

If you’d like to disable Site Accelerator in other specific situations instead, you can check this tutorial.

Entdecke die Vorteile von Jetpack

Erfahre, wie Jetpack deine WordPress-Website schützen, beschleunigen und beim Wachstum unterstützen kann.

Tarife entdecken

Hast du eine Frage?

Kommentare sind für diesen Artikel geschlossen, aber wir helfen dir trotzdem gerne weiter! Besuche das Support-Forum – wir beantworten dort gerne deine Fragen.

Support-Forum anzeigen