Admin Post List table Query filtering “WHERE” for custom post type

Awesome. This works! Thanks @Milo /*Change results based on the current user’s role and status */ function posts_for_current_role($query) { global $pagenow; if( ‘edit.php’ != $pagenow || !$query->is_admin ) return $query; if( current_user_can(‘editor’)): //Add query where clause to status equals “working”. $query->set( ‘post_status’, array( ‘working’, ‘draft’ ) ); endif; if( current_user_can(‘administrator’)): $query->set( ‘post_status’, array( ‘published’) ); … Read more

Best Way To Locate Offending WP Table

It’s unusual to include/require files based on database values, but if that’s what’s happening — one way to track it down would be to export the DB from production to an SQL file (which maybe you already have), then search through it with a text editor. You should then be able to look at the … Read more

How to use rowspan in WP List Table?

I extended WP_List_Table to My_Custom_List_Table class and customize My_Custom_List_Table for my purpose. Specially, function single_row_columns() and function display_rows_or_placeholder(). And, not echo some td tag for other main td tag that have rowspan. All process was not such difficult.

MySQL update text field with ‘

Apparently someplace in the wp_list_table, or maybe someplace else, the escape character \ was inserted before any ‘ . I was able to solve this by adding this line of code just before the $wpdb->update statement. $item[‘RecordedSubdivision’] = str_replace(“\'”, “‘”,$item[‘RecordedSubdivision’]);