How to use WP_Terms_List_Table in plugin
-
Hello,
I need to use the WP_Terms_List_Table class in my plugin in order to list the categories in a “WordPress like” table (I can remade the table, but it’s not efficient).
I tried this code :
$_POST['taxonomy'] = 'category'; $tax = get_taxonomy( 'category' ); if ( !current_user_can( $tax->cap->manage_terms ) ) wp_die( __( 'Cheatin’ uh?' ) ); $wp_list_table = _get_list_table('WP_Terms_List_Table'); $pagenum = $wp_list_table->get_pagenum(); $title = $tax->labels->name; add_screen_option( 'per_page', array('label' => $title, 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page') ); $wp_list_table->prepare_items(); $wp_list_table->display();
The table exists, but still empty. In fact, not really empty, the tbody looks like this :
<tbody class="list:tag" id="the-list"> <tr class="alternate" id="tag-7"> <td></td> </tr> <tr id="tag-6"> <td></td> </tr> <tr class="alternate" id="tag-5"> <td></td> </tr> <tr id="tag-4"> <td></td> </tr> <tr class="alternate" id="tag-9"> <td></td> </tr> <tr id="tag-3"> <td></td> </tr> <tr class="alternate" id="tag-1"> <td></td> </tr> </tbody>
The categories lines exist, but without any informations (name, slug,…).
What should I do in order to obtain a correct table ?
Thanks in advance, sorry if my english is weird, I’m French.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to use WP_Terms_List_Table in plugin’ is closed to new replies.