wp_ajax_delete_page( string $action )
Ajax handler to delete a page.
Description Description
Parameters Parameters
- $action
-
(string) (Required) Action to perform.
Source Source
File: wp-admin/includes/ajax-actions.php
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | function wp_ajax_delete_page( $action ) { if ( empty ( $action ) ) { $action = 'delete-page' ; } $id = isset( $_POST [ 'id' ] ) ? (int) $_POST [ 'id' ] : 0; check_ajax_referer( "{$action}_$id" ); if ( ! current_user_can( 'delete_page' , $id ) ) { wp_die( -1 ); } if ( ! get_post( $id ) ) { wp_die( 1 ); } if ( wp_delete_post( $id ) ) { wp_die( 1 ); } else { wp_die( 0 ); } } |
Expand full source code Collapse full source code View on Trac
Changelog Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |