“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

How to remove the bottom table headers (column names) in WP_List_Table?

You can override the WP_List_Table::display() method and remove the tfoot which contains the bottom table headers: <tfoot> <tr> <?php $this->print_column_headers( false ); ?> </tr> </tfoot> Or you can add a specific class to the relevant admin page and use CSS to visually hide the bottom table headers: .my-plugin-foo-page table.wp-list-table > tfoot { display: none; }

Index of row in WP_List_Table

That should be possible, but it looks pretty complicated. As you have undoubtedly seen, the display_rows method just passes a single line and there’s no counter. This means that the row number must be in the $item variable for you to extract it. Since it is not there natively, you must insert it before you … Read more