示例#1
0
function wpv_ct_bulk_delete_callback() {
	wpv_ajax_authenticate( 'wpv_view_listing_actions_nonce', array( 'parameter_source' => 'post', 'type_of_death' => 'data' ) );

	if( !isset( $_POST['ids'] ) ) {
		$ct_ids = array();
	} else if( is_string( $_POST['ids'] ) ) {
		$ct_ids = array( $_POST['ids'] );
	} else {
		$ct_ids = $_POST['ids'];
	}

    global $WPV_settings;

    foreach( $ct_ids as $ct_id ) {
		wpv_replace_views_template_options( $ct_id, 0, $WPV_settings );
		wp_delete_post( $ct_id );
	}
	
	$WPV_settings->save();

	wp_send_json_success();
}
function wpv_ct_bulk_delete_callback()
{
    if (!current_user_can('manage_options')) {
        die("Untrusted user");
    }
    if (!wp_verify_nonce($_POST["wpnonce"], 'wpv_view_listing_actions_nonce')) {
        die("Security check");
    }
    if (!isset($_POST['ids'])) {
        $ct_ids = array();
    } else {
        if (is_string($_POST['ids'])) {
            $ct_ids = array($_POST['ids']);
        } else {
            $ct_ids = $_POST['ids'];
        }
    }
    global $WPV_settings;
    foreach ($ct_ids as $ct_id) {
        wpv_replace_views_template_options($ct_id, 0, $WPV_settings);
        wp_delete_post($ct_id);
    }
    $WPV_settings->save();
    echo '1';
    die;
}