diff --git a/projects/plugins/jetpack/changelog/fix-class-not-found-error b/projects/plugins/jetpack/changelog/fix-class-not-found-error new file mode 100644 index 0000000000000..1fd5a98213c4a --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-class-not-found-error @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Fix Fatal Error: Class 'Jetpack_Subscriptions_Widget' not found during REST API diff --git a/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php b/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php index 6d46ab39ff9a1..3c16140fb731a 100644 --- a/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php +++ b/projects/plugins/jetpack/extensions/blocks/subscriptions/subscriptions.php @@ -646,6 +646,10 @@ function render_block( $attributes ) { Jetpack_Gutenberg::load_styles_as_required( FEATURE_NAME ); } + if ( ! class_exists( 'Jetpack_Subscriptions_Widget' ) ) { + return ''; + } + $subscribe_email = Jetpack_Memberships::get_current_user_email(); /** This filter is documented in \Automattic\Jetpack\Forms\ContactForm\Contact_Form */