Accepting certain HTML tags in WP List Table column data
Accepting certain HTML tags in WP List Table column data
Accepting certain HTML tags in WP List Table column data
Undefined index: hook_suffix
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
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
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
Found it, the action needs to be defined in your plugin function: function process_bulk_action() {
$data = $wpdb->get_results($sql, ARRAY_A); Adding ARRAY_A forces get_results to return an associative array.
You need to wrap your table into form tag, otherwise your bulk action button won’t work.
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
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