Skip to content

Commit

Permalink
Jetpack outdated WP notices: avoid fatals on outdated WP versions (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeherve authored Oct 18, 2024
1 parent f70f121 commit 7512e82
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/backup/changelog/revert-admin_notice_37051
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

General: ensure the notice displayed when running an old version of WordPress can always be displayed without errors.
16 changes: 9 additions & 7 deletions projects/plugins/backup/jetpack-backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ function jetpack_backup_requirements_check() {
add_action(
'admin_notices',
function () use ( $jetpack_backup_meets_requirements ) {
wp_admin_notice(
esc_html( $jetpack_backup_meets_requirements->get_error_message() ),
array(
'type' => 'error',
'dismissible' => true,
)
);
?>
<div class="notice notice-error is-dismissible">
<p>
<?php
echo esc_html( $jetpack_backup_meets_requirements->get_error_message() );
?>
</p>
</div>
<?php
}
);

Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/revert-admin_notice_37051
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: compat

General: ensure the notice displayed when running an old version of WordPress can always be displayed without errors.
12 changes: 5 additions & 7 deletions projects/plugins/jetpack/jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,11 @@
* @since 7.2.0
*/
function jetpack_admin_unsupported_wp_notice() {
wp_admin_notice(
esc_html__( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ),
array(
'type' => 'error',
'dismissible' => true,
)
);
?>
<div class="notice notice-error is-dismissible">
<p><?php esc_html_e( 'Jetpack requires a more recent version of WordPress and has been paused. Please update WordPress to continue enjoying Jetpack.', 'jetpack' ); ?></p>
</div>
<?php
}

add_action( 'admin_notices', 'jetpack_admin_unsupported_wp_notice' );
Expand Down

0 comments on commit 7512e82

Please sign in to comment.