Created
January 17, 2021 09:47
-
-
Save gvgvgvijayan/4b9fd90ad26ef5dba74a594c778f31f3 to your computer and use it in GitHub Desktop.
This gist is used in the tutorial https://www.vijayan.in/how-to-create-custom-table-list-in-wordpress-admin-page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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