Wp_List_Table not responsive

i’m using wp-list-table without the (php) class but html only and wanna share my research. There is some stuff to watch if you need a responsive table when building a wp-list-table yourself: add class column-primary to header th and body td. If this class is missing the table gets messy in mobile view add button … Read more

remove $_GET-parameter from WP_List_Table::tablenav

You should consider the POST request method for your action. Otherwise you might try to hijack the set_url_scheme filter with: add_filter( ‘set_url_scheme’, ‘wpse_remove_arg’ ); function wpse_remove_arg( $url ) { return remove_query_arg( ‘do_action_xyz’, $url ); } Then you could try to narrow the scope and only run this on the corresponding table page. Further you could … Read more

“Add New” button on custom post type grid

As per comments you likely you want to use native editor rather than build one from scratch. From poking through the core source outputting the link for that would be along the lines of: $post_new_file = “post-new.php?post_type=$post_type” if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) echo ‘ <a href=”‘ . esc_url( admin_url( $post_new_file … Read more

List all users and current week entries

If by “made an entry” you mean “has published at least 1 post”, then following will do it (with the proviso given below): $args = array ( ‘role’ => ‘spectator’, ) ; $spectators = new WP_User_Query ($args) ; $users_with_recent_posts = array () ; foreach ($spectators->get_results () as $user) { $args = array ( // if … Read more

how to make custom link in wordpress

I am assuming the \ are not part of your code, but if they are then those need to be removed. You also are trying to use $user_id without ever declaring it. Here is how I would write the function: function cgc_ub_action_links( $actions, $user_object ) { $url = add_query_arg( array( ‘page_id’ => 13, ‘um_user’ => … Read more

Didn’t get array of users like in delete action WPList table in users tab

You’re handling the request incorrectly, load-users.php is not the correct hook Instead, use handle_bulk_actions-users add_filter( ‘handle_bulk_actions-users’, ‘sanzeeb_bulk_action_handler_user’, 10, 3 ); function sanzeeb_bulk_action_handler_user( $redirect, $action, $object_ids ) { // let’s remove query args first $redirect = remove_query_arg( array( ‘assign’ ), $redirect ); // do something for “Assign” bulk action if ( $doaction == ‘assign’ ) { … Read more

Create Add New button [closed]

Regarding the “Add new” part, here’s an example that I assume will help you. I haven’t used WP_List_Table so unfortunately I can’t comment much on that. But based on the class reference I’d guess you’d need to use the get_columns() method. Using the code below you should be able to generate an url that you … Read more