Skip to content

Conversation

@dd32
Copy link
Member

@dd32 dd32 commented Oct 7, 2022

Avoids a E_NOTICE: Undefined index: hook_suffix in wp-admin/includes/class-wp-screen.php:224 notice.

Trac ticket: https://core.trac.wordpress.org/ticket/49089


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

…es a `WP_Screen` instance is created outside of an admin view.
@mukeshpanchal27
Copy link
Member

@dd32 thanks for the PR. We have similar issue in https://core.trac.wordpress.org/ticket/16502 we end up with this error. #3152 (comment).

if ( $hook_name ) { $id = $hook_name; } elseif ( wp_doing_ajax() && isset( $_REQUEST['action'] ) ) { $id = 'wp_ajax_' . esc_attr( $_REQUEST['action'] ); } elseif ( isset( $GLOBALS['hook_suffix'] ) ) { $id = $GLOBALS['hook_suffix']; } else { $id = ''; // Or just let it fail here. } 
@dream-encode
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants