#38805 closed defect (bug) (maybelater)
A hook is missing in class WP_List_Table
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.6.1 |
| Component: | Administration | Keywords: | 2nd-opinion has-patch close |
| Focuses: | Cc: |
Description
If I want to add a column to a WP_List_Table, I used this hooks :
manage_{$this->screen->id}_columnsmanage_{$this->screen->id}_sortable_columnsmanage_{$screen->id}_custom_column
But the last one doesn't exist in WP_List_Table, I can create a column but I can't insert data into.
Here the documentation :
https://make.wordpress.org/docs/plugin-developer-handbook/10-plugin-components/custom-list-table-columns/#output-table-cell-contents
Here the source of WP_List_Table :
https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-list-table.php
Actually, I want to hook a plugin with this hook, I can't add columns.
Thanks
Attachments (2)
Change History (12)
#2
in reply to:
↑ 1
@
9 years ago
Yes it is, but not in WP_List_Table, we can't hook this class. Ant it used in many projects.
Replying to SergeyBiryukov:
But the last one doesn't exist in WP_List_Table, I can create a column but I can't insert data into.
It exists in classes that extend
WP_List_Tablethough:
#3
follow-ups:
↓ 4
↓ 6
@
7 years ago
- Keywords 2nd-opinion added
Marking this for a second opinion. The WP_List_Table is meant to be a base class, but the other two filters do exist in WP_List_Table today. So I could see adding this filter.
@madvic is this still a pain point for you?
#4
in reply to:
↑ 3
@
7 years ago
Hi @desrosj ,
I have to used it for projects.
For me the code is not consistent. That's why my ticket.
Replying to desrosj:
Marking this for a second opinion. The
WP_List_Tableis meant to be a base class, but the other two filters do exist inWP_List_Tabletoday. So I could see adding this filter.
@madvic is this still a pain point for you?
#6
in reply to:
↑ 3
@
6 years ago
- Severity changed from normal to major
Replying to desrosj:
Marking this for a second opinion. The
WP_List_Tableis meant to be a base class, but the other two filters do exist inWP_List_Tabletoday. So I could see adding this filter.
@madvic is this still a pain point for you?
@desrosj Has there been any progress on this? I found this thread in my own search for a solution. I am trying to add a custom column to a custom table of an installed plugin. I too followed the same article as @madvic https://make.wordpress.org/docs/plugin-developer-handbook/10-plugin-components/custom-list-table-columns/#output-table-cell-contents
I was able to add the column to the table with
manage_{$this->screen->id}_columns
using the screen ID of that plugin's table page. However, as stated, the
manage_{$screen->id}_custom_column
doesn't seem to exist, so my content won't display in the columns.
As this table isn't a custom post type, or any of the other class available as stated by @SergeyBiryukov , I'm unable to add content with any of those options. This is the screen object readout for that table's page, and you can see that there's no post type, taxonomy, etc for me to use, and since {$screen->id} doesn't work, I'm at a loss:
WP_Screen Object ( [action] => [base] => memberpress_page_memberpress-members [columns:WP_Screen:private] => 0 [id] => memberpress_page_memberpress-members [in_admin:protected] => site [is_network] => [is_user] => [parent_base] => [parent_file] => [post_type] => [taxonomy] => [_help_tabs:WP_Screen:private] => Array ( ) [_help_sidebar:WP_Screen:private] => [_screen_reader_content:WP_Screen:private] => Array ( ) [_options:WP_Screen:private] => Array ( ) [_show_screen_options:WP_Screen:private] => [_screen_settings:WP_Screen:private] => [is_block_editor] => )
Being able to add content to the column in this table would be a huge help. I'd love to know if there is a way to do this yet. Thank you!
#7
@
4 years ago
- Keywords has-patch added
@SergeyBiryukov @desrosj Initial patch added in case there is no more discussion needed.
#8
@
5 months ago
- Keywords close added
Hi all,
This ticket hasn't had any movement in a few years now. While this is probably useful to have, it seems the broader community isn't pressing for it, given the lack of action.
Could a core committer or a lead developer please chime in on whether this ticket will get support for merge? If there are no current plans to incorporate this change, closing it would help reduce the huge backlog in Trac.
#9
@
3 months ago
- Resolution set to maybelater
- Status changed from new to closed
Hey all,
Closing this ticket due to inactivity and lack of community response over the past years. While the original request for a manage_{$screen->id}_custom_column hook is understandable, the extended period without further discussion suggests alternative solutions may suffice. If this changes, please reopen.
It exists in classes that extend
WP_List_Tablethough: