[wp-trac] [WordPress Trac] #15386: WP_List_Table::get_columns does not work for plugins

WordPress Trac noreply at wordpress.org
Tue Nov 8 07:54:43 UTC 2016


#15386: WP_List_Table::get_columns does not work for plugins
--------------------------+-----------------------
 Reporter:  ptahdunbar    |       Owner:  scribu
     Type:  defect (bug)  |      Status:  reopened
 Priority:  high          |   Milestone:
Component:  General       |     Version:  3.1
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------
Changes (by pcfreak30):

 * status:  closed => reopened
 * resolution:  worksforme =>


Comment:

 This still appears to be an issue. I tracked it down in `admin.php` ->
 `admin-header.php` -> `$current_screen->render_screen_meta()` ->
 `show_screen_options()` -> `get_column_headers`.

 get_column_headers gets called in the header before the table can even be
 created. Due to get_column_headers using a static, it can not be unset and
 causes empty result.

 Only workaround I found was hooking admin_init, running
 set_current_screen(), creating the table in a private class property then
 accessing it on the plugins menu hook to render.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/15386#comment:15>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list