List table not rendering when $this->items is filled

I did same error first time I implemented WP_List_Table. The problem is that when you call WP_List_Table::display() WordPress in turn calls: WP_List_Table::display_rows_or_placeholder() WP_List_Table::display_rows() WP_List_Table::single_row() WP_List_Table::single_row_columns() Last function is called for every row. If you look at its code (see source), it has: if ( ‘cb’ == $column_name ) { // you don’t have ‘cb’ column, … Read more

How to remove _wp_http_referer from URL when using WP_List_table?

As the last commenter on that Q suggested, you should probably check for actions, remove the query args and redirect. Something like: $doaction = $wp_list_table->current_action(); if ( $doaction && isset( $_REQUEST[‘SOMEVAR’] ) ) { // do stuff } elseif ( ! empty( $_GET[‘_wp_http_referer’] ) ) { wp_redirect( remove_query_arg( array( ‘_wp_http_referer’, ‘_wpnonce’ ), stripslashes( $_SERVER[‘REQUEST_URI’] ) … Read more

Fatal error after 4.4 upgrade class-wp-list-table

Nice solution you have there. But you must define a $screen property inside WP_List_Table class (or its child class) before pagination method is invoked. You want to make the $screen property as WP_Screen instance using this function : $this->screen = get_current_screen(); There you go, and your table is ready to go. Thanks

WP List Table custom quick edit box – post meta data missing and columns change on submit

I just run in the same error when adding extra columns to the default post types. The offending line was the $pagenow check. Quick Edit uses admin-ajax.php so it doesn’t renders the custom columns when it’s done. This doesn’t work: if( ‘edit.php’ == $pagenow && is_admin() ) { add_action( ‘admin_init’, array( $this, ‘init_id_column’ ), 999 … Read more

Why does my custom taxonomy show a total count across all post types

There is currently a trac ticket on the fact that taxonomy counts are global (include all post types). Related trac ticket. To fix this you can remove the column and add your own using the manage_edit-{$taxonomy}_columns filter: add_filter(‘manage_edit-season_columns’,’my_season_columns’); function my_season_columns($columns){ unset($columns[‘posts’]); $columns[‘cpt_count’] = ‘Races’; return $columns; } You then tell WordPress what to fill this … Read more

wp_list_tables bulk actions

If you add a bulk-action, then you have to react on this action. Simply adding a function doesn’t do anything, you have to call it: class WPSE_List_Table extends WP_List_Table { public function __construct() { parent::__construct( array( ‘singular’ => ‘singular_form’, ‘plural’ => ‘plural_form’, ‘ajax’ => false ) ); } public function prepare_items() { $columns = $this->get_columns(); … Read more

Custom Table Column Sortable by Taxonomy Query

To achieve adding a custom sortable column to the WP_List_Table of your post type within the WordPress administration back-end dashboard, you will need to do the following: Replace all occurrences of YOUR-POST-TYPE-NAME with your actual post type name. Replace all occurrences of YOUR-TAXONOMY-NAME with your actual taxonomy name. Replace all occurrences of YOUR COLUMN NAME … Read more