Skip to content

Commit

Permalink
Ensure Jetpack Posts page Stats link points to wp-admin (#38376)
Browse files Browse the repository at this point in the history
  • Loading branch information
DustyReagan authored Jul 18, 2024
1 parent 742a6b2 commit bddf36a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/fix-posts-stats-link
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Ensure Jetpack posts stats link points to wp-admin stats
19 changes: 11 additions & 8 deletions projects/plugins/jetpack/modules/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<a href="%s" title="%s" class="dashicons dashicons-chart-bar" target="_blank"></a>',
Expand Down

0 comments on commit bddf36a

Please sign in to comment.