-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix undefined hook_suffix #666
Conversation
Without a specified `screen` when extending `WP_List_Table` - the function `convert_to_screen` will return a PHP Warning due to an undefined hook suffix which is needed to identify the current screen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dug into this issue further, and I found out that there is nothing wrong with the current implementation of Edit Flow.
It turns out the error itself is a bug of WordPress core.
https://core.trac.wordpress.org/ticket/49089
That said, this PR helps overcome the core bug above.
@@ -1729,7 +1729,8 @@ function __construct() { | |||
parent::__construct( array( | |||
'plural' => 'custom statuses', | |||
'singular' => 'custom status', | |||
'ajax' => true | |||
'ajax' => true, | |||
'screen' => 'ef-custom-status-settings', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, any value for screen
different from null
will get you through this error.
Good find! I saw that adding the Do you think there's anything we can suggest to Core that might improve this so that you don't need the |
I am pretty sure that it does not help to fix the issue as WP_List_Table class can be still initialized with
Yeah, I tried to find a simple way to replicate this issue last week but I failed somehow. I think this week with a fresh mind helps me to understand the root cause. I am going to write it down in #654 then post it to the trac issue. Update: I wrote up this comment to explain the core issue #654 (comment) |
Closing since it looks like it's been resolved per the trac ticket. |
Description
Fixes #654
Without a specified
screen
when extendingWP_List_Table
- the functionconvert_to_screen
will return a PHP Warning due to an undefined hook suffix which is needed to identify the current screenSteps to Test
[07-Jun-2021 17:34:31 UTC] PHP Warning: Undefined array key "hook_suffix" in /wp-admin/includes/class-wp-screen.php on line 223
Apply this PR and then do the steps again and you won't see the PHP Warning any longer.