Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: changed

Render the Premium Analytics admin page inside the native wp-admin shell (sidebar and header) instead of taking over the full screen.
15 changes: 10 additions & 5 deletions projects/packages/premium-analytics/src/class-analytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,24 @@ public static function is_dashboard_request() {
/**
* Register the admin menu page.
*
* The callback is __return_null because the wp-build interceptor
* renders the full-page app on admin_init and calls exit() before
* WordPress can invoke this callback.
* Uses the wp-build "wp-admin integrated" variant (`-wp-admin` slug) so the
* dashboard renders inside the native wp-admin shell, not the full-page
* variant that takes over the screen via admin_init. The render callback
* comes from the generated build, with a no-op fallback when it is absent.
*
* @return void
*/
public static function register_admin_menu() {
$render_callback = function_exists( 'jpa_jetpack_premium_analytics_wp_admin_render_page' )
? 'jpa_jetpack_premium_analytics_wp_admin_render_page'
: '__return_null';

add_menu_page(
esc_html( self::$menu_title ),
esc_html( self::$menu_title ),
'manage_options',
'jetpack-premium-analytics',
'__return_null',
'jetpack-premium-analytics-wp-admin',
$render_callback,
'dashicons-chart-bar',
30
);
Expand Down
Loading