WordPress.org

Make WordPress Core

Ticket #9674: template.php.diff

File template.php.diff, 1.8 KB (added by jfarthing84, 4 years ago)

Fix trash/untrash/delete links for custom post types.

  • template.php

     
    13611361                        } 
    13621362                        if ( current_user_can($post_type_object->delete_cap, $post->ID) ) { 
    13631363                                if ( 'trash' == $post->post_status ) 
    1364                                         $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>"; 
     1364                                        $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . '&amp;action=untrash', $post->ID) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Restore') . "</a>"; 
    13651365                                elseif ( EMPTY_TRASH_DAYS ) 
    13661366                                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . get_delete_post_link($post->ID) . "'>" . __('Trash') . "</a>"; 
    13671367                                if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 
    1368                                         $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>"; 
     1368                                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url( admin_url( sprintf($post_type_object->_edit_link . '&amp;action=delete', $post->ID) ), 'delete-' . $post->post_type . '_' . $post->ID ) . "'>" . __('Delete Permanently') . "</a>"; 
    13691369                        } 
    13701370                        if ( in_array($post->post_status, array('pending', 'draft')) ) { 
    13711371                                if ( current_user_can($post_type_object->edit_cap, $post->ID) )