Add custom column at custom posts list

Adding A New Column To The books Post Table Here we can use the filters manage_{$post->post_type}_posts_custom_column manage_{$post->post_type}_posts_columns or for the books post type: manage_books_posts_custom_column manage_books_posts_columns Here’s an example how we could display a button, for each row in the send_email column: /** * Books Post Table: Display a utton in each row in the ‘send_email’ … Read more

How to Remove Certain Screen Options and Table Columns from post type in wp_list_table?

What you need is to modify the $columns variable that is used during list display which you can modify using the ‘manage_posts_columns’ and ‘manage_pages_columns’ hooks for post_type=”post” and post_type=”page”, respectively. If you want to ignore custom post types you can inspect the 2nd parameter passed to ‘manage_posts_columns’ as I did in my example to show … Read more

Modify column_author in WP_Comments_List_Table

This is how the email part is displayed by the WP_Comments_List::column_author() method: /* This filter is documented in wp-includes/comment-template.php */ $email = apply_filters( ‘comment_email’, $comment->comment_author_email, $comment ); if ( ! empty( $email ) && ‘@’ !== $email ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/258903/%1$s”>%2$s</a><br />’, esc_url( ‘mailto:’ . $email ), esc_html( $email ) ); } so you’re … 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

How to make a custom column on the Users admin screen sortable?

This is my code which adds a sortable custom column (called Vendor ID) to the users table: function fc_new_modify_user_table( $column ) { $column[‘vendor_id’] = ‘Vendor ID’; return $column; } add_filter( ‘manage_users_columns’, ‘fc_new_modify_user_table’ ); function fc_new_modify_user_table_row( $val, $column_name, $user_id ) { switch ($column_name) { case ‘vendor_id’ : return get_the_author_meta( ‘vendor_id’, $user_id ); default: } return $val; … Read more

Change the order of columns for a custom post type on the admin list page

Yes this is possible. I have changed this for the default post type, but this is also possible for a custom one. First check the codex: http://codex.wordpress.org/Plugin_API/Action_Reference/manage_posts_custom_column function your_columns_head($defaults) { $new = array(); $tags = $defaults[‘tags’]; // save the tags column unset($defaults[‘tags’]); // remove it from the columns list foreach($defaults as $key=>$value) { if($key==’date’) { … Read more

How to Remove Certain Screen Options and Meta Boxes from add/edit post type?

What you need is in global $wp_meta_boxes indexed by get_current_screen()->id. Removing the screen options will also remove the metaboxes which you can do just before screen options are displayed using the ‘in_admin_header’ hook. So let’s assume you want to get rid of the “Send Trackbacks” screen option which you see in this screenshot: Drop the … Read more

Custom columns for taxonomy list table

The manage_{TAXONOMY}_custom_column filter hook passes 3 arguments: $content $column_name $term_id So try this: function add_book_place_column_content($content,$column_name,$term_id){ $term= get_term($term_id, ‘book_place’); switch ($column_name) { case ‘foo’: //do your stuff here with $term or $term_id $content=”test”; break; default: break; } return $content; } add_filter(‘manage_book_place_custom_column’, ‘add_book_place_column_content’,10,3);