|
@@ 142-153 (lines=12) @@
|
| 139 |
|
} |
| 140 |
|
$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location ); |
| 141 |
|
break; |
| 142 |
|
case 'untrash': |
| 143 |
|
if ( !isset( $post_ids ) ) |
| 144 |
|
break; |
| 145 |
|
foreach ( (array) $post_ids as $post_id ) { |
| 146 |
|
if ( !current_user_can( 'delete_post', $post_id ) ) |
| 147 |
|
wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) ); |
| 148 |
|
|
| 149 |
|
if ( !wp_untrash_post( $post_id ) ) |
| 150 |
|
wp_die( __( 'Error in restoring from Trash.' ) ); |
| 151 |
|
} |
| 152 |
|
$location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
| 153 |
|
break; |
| 154 |
|
case 'delete': |
| 155 |
|
if ( !isset( $post_ids ) ) |
| 156 |
|
break; |
|
@@ 154-165 (lines=12) @@
|
| 151 |
|
} |
| 152 |
|
$location = add_query_arg( 'untrashed', count( $post_ids ), $location ); |
| 153 |
|
break; |
| 154 |
|
case 'delete': |
| 155 |
|
if ( !isset( $post_ids ) ) |
| 156 |
|
break; |
| 157 |
|
foreach ( (array) $post_ids as $post_id_del ) { |
| 158 |
|
if ( !current_user_can( 'delete_post', $post_id_del ) ) |
| 159 |
|
wp_die( __( 'Sorry, you are not allowed to delete this item.' ) ); |
| 160 |
|
|
| 161 |
|
if ( !wp_delete_attachment( $post_id_del ) ) |
| 162 |
|
wp_die( __( 'Error in deleting.' ) ); |
| 163 |
|
} |
| 164 |
|
$location = add_query_arg( 'deleted', count( $post_ids ), $location ); |
| 165 |
|
break; |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
wp_redirect( $location ); |