diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php
index 251828584..a94832ad7 100644
--- a/wp-admin/includes/meta-boxes.php
+++ b/wp-admin/includes/meta-boxes.php
@@ -194,14 +194,12 @@ if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
ID ) ) {
- if ( !EMPTY_TRASH_DAYS ) {
- $delete_url = wp_nonce_url( add_query_arg( array('action' => 'delete', 'post' => $post->ID), admin_url( 'post.php' ) ), "delete-${post_type}_{$post->ID}" );
+ if ( !EMPTY_TRASH_DAYS )
$delete_text = __('Delete Permanently');
- } else {
- $delete_url = wp_nonce_url( add_query_arg( array('action' => 'trash', 'post' => $post->ID), admin_url( 'post.php' ) ), "trash-${post_type}_{$post->ID}" );
+ else
$delete_text = __('Move to Trash');
- } ?>
-
+
diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php
index 08ba12379..fe402d698 100644
--- a/wp-admin/includes/template.php
+++ b/wp-admin/includes/template.php
@@ -1359,7 +1359,7 @@ function _post_row($a_post, $pending_comments, $mode) {
elseif ( EMPTY_TRASH_DAYS )
$actions['trash'] = "" . __('Trash') . "";
if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
- $actions['delete'] = "ID) ), 'delete-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Delete Permanently') . "";
+ $actions['delete'] = "" . __('Delete Permanently') . "";
}
if ( in_array($post->post_status, array('pending', 'draft')) ) {
if ( current_user_can($post_type_object->edit_cap, $post->ID) )
diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php
index 52a06221c..c26dafb80 100644
--- a/wp-includes/link-template.php
+++ b/wp-includes/link-template.php
@@ -821,29 +821,22 @@ function edit_post_link( $link = null, $before = '', $after = '', $id = 0 ) {
/**
* Retrieve delete posts link for post.
*
- * Can be used within the WordPress loop or outside of it. Can be used with
- * pages, posts, attachments, and revisions.
+ * Can be used within the WordPress loop or outside of it, with any post type.
*
* @since 2.9.0
*
* @param int $id Optional. Post ID.
- * @param string $context Optional, default to display. How to write the '&', defaults to '&'.
+ * @param string $deprecated Not used.
+ * @param bool $force_delete Whether to bypass trash and force deletion. Default is false.
* @return string
*/
-function get_delete_post_link($id = 0, $context = 'display') {
+function get_delete_post_link( $id = 0, $deprecated = '', $force_delete = false ) {
+ if ( ! empty( $deprecated ) )
+ _deprecated_argument( __FUNCTION__, '3.0.0' );
+
if ( !$post = &get_post( $id ) )
return;
- if ( 'display' == $context )
- $action = 'action=trash&';
- else
- $action = 'action=trash&';
-
- if ( 'display' == $context )
- $action = '&action=trash';
- else
- $action = '&action=trash';
-
$post_type_object = get_post_type_object( $post->post_type );
if ( !$post_type_object )
return;
@@ -851,7 +844,11 @@ function get_delete_post_link($id = 0, $context = 'display') {
if ( !current_user_can( $post_type_object->delete_cap, $post->ID ) )
return;
- return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), "trash-{$post->post_type}_" . $post->ID), $post->ID, $context );
+ $action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
+
+ $delete_link = add_query_arg( 'action', $action, admin_url( sprintf( $post_type_object->_edit_link, $post->ID ) ) );
+
+ return apply_filters( 'get_delete_post_link', wp_nonce_url( $delete_link, "$action-{$post->post_type}_{$post->ID}" ), $post->ID, $force_delete );
}
/**