WordPress.org

Support

Support » Alpha/Beta » [Resolved] PHP (!) Notice because constructor for class WP_List_Table

[Resolved] PHP (!) Notice because constructor for class WP_List_Table

  • David Lingren
    Participant

    @dglingren

    A fourth argument, ‘screen’, has been added to the constructor for class WP_List_Table. The default value for this argument (null) causes the following PHP message when the class is used in an Ajax handler:

    Notice: Undefined index: hook_suffix in ... \wp-admin\includes\screen.php on line 401

    The call stack is:

    1 {main}( ) ..\admin-ajax.php:0
    2 do_action( ) ..\admin-ajax.php:70
    3 call_user_func_array ( ) ..\plugin.php:406
    4 MLA::mla_inline_edit_action( ) ..\plugin.php:0
    5 MLA_List_Table->__construct( ) ..\class-mla-main.php:864
    6 WP_List_Table->__construct( ) ..\class-mla-list-table.php:382
    7 convert_to_screen( ) ..\class-wp-list-table.php:88
    8 WP_Screen::get( ) ..\template.php:1874

    Where can I find some guidance on how to use this new ‘screen’ parameter in an Ajax handler?

Viewing 1 replies (of 1 total)
  • Andrew Nacin
    Lead Developer

    @nacin

    When calling _get_list_table('Your_Table_Name'), you can pass array( 'screen' => $screen ) as an argument. This is really for list tables that need to know what screen they are on. For example, what post type for the WP_Posts_List_Table…

    You should ideally pass the screen name of your plugin (the hook_suffix). Of course, that’s only if you need it.

    I created http://core.trac.wordpress.org/ticket/22570 to suppress the notice and any potential side effects for when there is no screen passed.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] PHP (!) Notice because constructor for class WP_List_Table’ is closed to new replies.