Jetpack Photon Depreciated Message (with code fix)
-
Hi,
Love your plugin. It has worked perfectly for years. It looks like there’s been a change by Automattic. I’m getting the following error on my webpage in the php-errors.log file.
Deprecated: Function Jetpack_Photon::filter_the_content is deprecated since Jetpack 12.2. Use Automattic\Jetpack\Image_CDN\Image_CDN::filter_the_content instead.
The Jetpack_Photon::filter_the_content function will be removed in Jetpack 12.8.
(/wp-includes/functions.php on line 6121)I tracked this back to Boxzilla on the default-filters.php.
Here is the offending line:
if (class_exists('Jetpack') && class_exists('Jetpack_Photon') && method_exists('Jetpack', 'is_module_active') && Jetpack::is_module_active('photon')) {
add_filter('boxzilla_box_content', [ 'Jetpack_Photon', 'filter_the_content' ], 999999);
}Here’s a potential fix (from GPT-5):
// Jetpack < 12.2: use Photon
if (
class_exists('Jetpack') &&
class_exists('Jetpack_Photon') &&
method_exists('Jetpack', 'is_module_active') &&
Jetpack::is_module_active('photon')
) {
add_filter('boxzilla_box_content', [ 'Jetpack_Photon', 'filter_the_content' ], 999999);
}
// Jetpack 12.2+: use Image_CDN
if (
class_exists('\Automattic\Jetpack\Image_CDN\Image_CDN') &&
method_exists('\Automattic\Jetpack\Image_CDN\Image_CDN', 'filter_the_content')
) {
add_filter('boxzilla_box_content', [ '\Automattic\Jetpack\Image_CDN\Image_CDN', 'filter_the_content' ], 999999);
}How it works:
- If Jetpack Photon module is active (for older Jetpack), it runs the old filter.
- If Jetpack 12.2+ Image CDN class is present, it runs the updated filter.
Please let me know if there’s anything further I can do to help.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Jetpack Photon Depreciated Message (with code fix)’ is closed to new replies.