[Plugin: Custom List Table Example] Add custom filter
-
This plugin is perfect to create new admin screens ??
There’s a example of how to add a “builk action” (delete…) but I need to add a custom filter and I had some problem because I don’t know how to put the code.Here is what I wrote. :
function get_bulk_actions() { $actions = array( // I don't need to delete post in my case //'delete' => 'Delete' ); // Display date // For this example, I use a fonction in class-wp-liste-table.php // that display months (I use my own function to display months but this one works for the example) $this->months_dropdown('post'); submit_button( __( 'Filter' ), 'secondary', false, false, array( 'id' => 'post-query-submit' ) ); return $actions; }
This code displays a drop-down list with months with a submit button.
But when I submit, I have some url parameters (get) that shouldn’t have to be there.admin.php?page=tt_list_test&_wpnonce=f008999aef&_wp_http_referer=%2Fwp-admin%2Fadmin.php%3Fpage%3Dtt_list_test
_wpnonce & _wp_http_referer shouldn’t have to be url parameters.
And if I sort a column and change the month, it loses the order
Order :
/admin.php?page=tt_list_test&orderby=nom&order=desc
=>
Change date :
/admin.php?page=tt_list_test&_wpnonce=f008999aef&_wp_http_referer=%2Fwp-admin%2Fadmin.php%3Fpage%3Dtt_list_test%26orderby%3Dnom%26order%3Ddesc&m=201111&paged=1Thank for your help.
https://www.ads-software.com/extend/plugins/custom-list-table-example/
- The topic ‘[Plugin: Custom List Table Example] Add custom filter’ is closed to new replies.