Make WordPress Core

Opened 20 months ago

Closed 11 months ago

Last modified 3 months ago

#56575 closed enhancement (invalid)

Make it possible to use custom class for Posts/Terms list table

Reported by: szaqal21's profile szaqal21 Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.0.2
Component: General Keywords:
Focuses: Cc:

Description

Currently there is no simple way to use custom class for displaying posts list table on /wp-admin/edit.php or terms list table on /wp-admin/edit-tags.php.

Both lists are being setup by _get_list_table() function.

I've managed to use my custom implementation of WP_Posts_List_Table class by adding a filter to "views_edit-{$typenow}" and swapping global $wp_list_table like so:

add_filter("views_edit-{$typenow}", array(&$this, 'views_edit'));

public function views_edit($views)
{
	global $wp_list_table;
	
	$wp_list_table = new PTC_Posts_List_Table();

	...
}

but this isn't a perfect solution, it would be great to add some kind of filter (perhaps in _get_list_table()) to use custom class.

Change History (2)

#1 @szaqal21
11 months ago

  • Resolution set to invalid
  • Status changed from new to closed

WP 6.1 introduced a new filter https://developer.wordpress.org/reference/hooks/wp_list_table_class_name/ which resolves this ticket.

#2 @swissspidy
3 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.