Skip to content
Open
Changes from 2 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
5 changes: 3 additions & 2 deletions src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,13 @@ function wp_ajax_get_community_events() {
function wp_ajax_dashboard_widgets() {
require_once ABSPATH . 'wp-admin/includes/dashboard.php';

$pagenow = $_GET['pagenow'];
$pagenow = isset( $_GET['pagenow'] ) ? sanitize_key( $_GET['pagenow'] ) : '';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$pagenow = isset( $_GET['pagenow'] ) ? sanitize_key( $_GET['pagenow'] ) : '';
$pagenow = sanitize_key( $_GET['pagenow'] ?? '' );

if ( 'dashboard-user' === $pagenow || 'dashboard-network' === $pagenow || 'dashboard' === $pagenow ) {
set_current_screen( $pagenow );
}

switch ( $_GET['widget'] ) {
$widget = isset( $_GET['widget'] ) ? sanitize_key( $_GET['widget'] ) : '';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$widget = isset( $_GET['widget'] ) ? sanitize_key( $_GET['widget'] ) : '';
$widget = sanitize_key( $_GET['widget'] ?? '' );

switch ( $widget ) {
case 'dashboard_primary':
wp_dashboard_primary();
break;
Expand Down
Loading