diff --git a/projects/plugins/jetpack/changelog/fix-posts-stats-link b/projects/plugins/jetpack/changelog/fix-posts-stats-link new file mode 100644 index 0000000000000..0e5c009bbe31d --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-posts-stats-link @@ -0,0 +1,4 @@ +Significance: patch +Type: other + +Ensure Jetpack posts stats link points to wp-admin stats diff --git a/projects/plugins/jetpack/modules/stats.php b/projects/plugins/jetpack/modules/stats.php index eb2a2b9fd2bc8..bfaa0a3495636 100644 --- a/projects/plugins/jetpack/modules/stats.php +++ b/projects/plugins/jetpack/modules/stats.php @@ -1811,14 +1811,17 @@ function jetpack_stats_post_table_cell( $column, $post_id ) { esc_html__( 'No stats', 'jetpack' ) ); } else { - $stats_post_url = 'wp-admin' === get_option( 'wpcom_admin_interface' ) - ? admin_url( sprintf( 'admin.php?page=stats#!/stats/post/%d/%d', $post_id, Jetpack_Options::get_option( 'id', 0 ) ) ) - : Redirect::get_url( - 'calypso-stats-post', - array( - 'path' => $post_id, - ) - ); + // Link to the wp-admin stats page. + $stats_post_url = admin_url( sprintf( 'admin.php?page=stats#!/stats/post/%d/%d', $post_id, Jetpack_Options::get_option( 'id', 0 ) ) ); + // Unless the user is on a Default style WOA site, in which case link to Calypso. + if ( ( new Host() )->is_woa_site() && Stats_Options::get_option( 'enable_odyssey_stats' ) && 'wp-admin' !== get_option( 'wpcom_admin_interface' ) ) { + $stats_post_url = Redirect::get_url( + 'calypso-stats-post', + array( + 'path' => $post_id, + ) + ); + } printf( '',