Skip to content

Instantly share code, notes, and snippets.

@gvgvgvijayan
Created January 17, 2021 09:47
Show Gist options
  • Save gvgvgvijayan/4b9fd90ad26ef5dba74a594c778f31f3 to your computer and use it in GitHub Desktop.
Save gvgvgvijayan/4b9fd90ad26ef5dba74a594c778f31f3 to your computer and use it in GitHub Desktop.
<?php
...
/**
* Get bulk actions.
*
* @return void
*/
public function process_bulk_action() {
if ( 'trash' === $this->current_action() ) {
$post_ids = filter_input( INPUT_GET, 'draft_id', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );
if ( is_array( $post_ids ) ) {
$post_ids = array_map( 'intval', $post_ids );
if ( count( $post_ids ) ) {
array_map( 'wp_trash_post', $post_ids );
}
}
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment