wp_ajax_trash_post() – Ajax handler for sending a post to the Trash.
You appear to be a bot. Output may be restricted
Description
Ajax handler for sending a post to the Trash.
Usage
wp_ajax_trash_post( $action );
Parameters
- $action
- ( string ) required – Action to perform.
Returns
void
Source
File name: wordpress/wp-admin/includes/ajax-actions.php
Lines:
1 to 28 of 28
function wp_ajax_trash_post( $action ) { if ( empty( $action ) ) { $action = 'trash-post'; } $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_post', $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( 'trash-post' === $action ) { $done = wp_trash_post( $id ); } else { $done = wp_untrash_post( $id ); } if ( $done ) { wp_die( 1 ); } wp_die( 0 ); }