Custom WP_List_Table: How to create an unapproved row?

Well, the yellow comes from <tr class=”unapproved”> and this is, in crass contrast to what the usual WP_List_Table introduction might suggest, not an automatism, but generated very verbatim: See e.g. single_row() in wp-admin/includes/class-wp-comments-list-table.php: function single_row( $a_comment ) { global $post, $comment; $comment = $a_comment; $the_comment_class = join( ‘ ‘, get_comment_class( wp_get_comment_status( $comment->comment_ID ) ) ); … Read more

Remove Admin Notice on page refresh

This is done by wp_admin_canonical_url: It calls wp_removable_query_args to fetch a list of query string parameters to remove, which includes settings-updated. It then writes some script into the page header to use window.history.replaceState to remove the query string from your browser’s URL bar. <link id=”wp-admin-canonical” rel=”canonical” href=”http://example.com/wp-admin/admin.php?page=xyz”> <script> if ( window.history.replaceState ) { window.history.replaceState( null, … Read more

How can I add a column in the wp_list_table of the admin area?

I think what you need is the set of filters and actions to add custom columns to post edit screens: manage_edit-post_type_columns: used to add columns manage_posts_custom_column: used to print the content of each row of the column manage_edit-post_type_sortable_columns: used to register sortable columns. Undocumented. request: you may need to use this filter in combination with … Read more

Is there a way to list posts of only a certain category

You can filter the posts list by appending ?category_name=xx to the admin posts list URL, and you can add a submenu page with that URL as the target via add_submenu_page: add_action( ‘admin_menu’, ‘wpd_admin_menu_item’ ); function wpd_admin_menu_item(){ add_submenu_page( ‘edit.php’, ‘Page title’, ‘Menu item title’, ‘edit_posts’, ‘edit.php?category_name=somecat’ ); }