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

Removing sorting option for columns on the post lists page

The filter hook manage_edit-post_sortable_columns contains all the columns, which are sortable. So you could hook into this filter and unset the title: <?php add_filter( ‘manage_edit-post_sortable_columns’, ‘wse_240787’ ); function wse_240787( $col ) { unset( $col[‘title’] ); return $col; } This filter is documented in wp-admin/includes/class-wp-list-table.php: /** * Filters the list table sortable columns for a specific … Read more

How to remove _wp_http_referer from URL when using WP_List_table?

As the last commenter on that Q suggested, you should probably check for actions, remove the query args and redirect. Something like: $doaction = $wp_list_table->current_action(); if ( $doaction && isset( $_REQUEST[‘SOMEVAR’] ) ) { // do stuff } elseif ( ! empty( $_GET[‘_wp_http_referer’] ) ) { wp_redirect( remove_query_arg( array( ‘_wp_http_referer’, ‘_wpnonce’ ), stripslashes( $_SERVER[‘REQUEST_URI’] ) … Read more

Fatal error after 4.4 upgrade class-wp-list-table

Nice solution you have there. But you must define a $screen property inside WP_List_Table class (or its child class) before pagination method is invoked. You want to make the $screen property as WP_Screen instance using this function : $this->screen = get_current_screen(); There you go, and your table is ready to go. Thanks

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)