[wp-trac] [WordPress Trac] #49089: hook_suffix is undefined in WP_Screen class
WordPress Trac
noreply at wordpress.org
Fri Oct 7 04:32:19 UTC 2022
#49089: hook_suffix is undefined in WP_Screen class
----------------------------+------------------------------
Reporter: splendorstudio | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
----------------------------+------------------------------
Comment (by dd32):
Just noting that this can also happen when using `WP_List_Table` through
`admin-post.php`, not just `admin-ajax.php`.
One solution is for List Tables to pass the screen property upstream to
`WP_List_Table` so it doesn't have to guess what the screen is.
{{{
class Example_List_Table extends WP_List_Table {
public function __construct( $details ) {
$this->details = $details;
parent::__construct(
array(
'screen' => 'toplevel_page_example' .
$this->details['slug']
)
);
}
}}}
Another is to simply only use `$hook_suffix` when it's known and valid. As
in [https://github.com/WordPress/wordpress-develop/pull/3415 PR #3415].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49089#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list