WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/21/2010 06:53:33 AM (11 years ago)
Author:
ryan
Message:

Update trash and right now links for pages. fixes #11958

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r12733 r12783  
    738738        $action = 'action=trash&';
    739739
    740     switch ( $post->post_type ) :
    741     case 'page' :
    742         if ( !current_user_can( 'delete_page', $post->ID ) )
    743             return;
    744         $file = 'page';
    745         $var  = 'post';
    746         break;
    747     case 'attachment' :
    748         if ( !current_user_can( 'delete_post', $post->ID ) )
    749             return;
    750         $file = 'media';
    751         $var  = 'attachment_id';
    752         break;
    753     case 'revision' :
    754         if ( !current_user_can( 'delete_post', $post->ID ) )
    755             return;
    756         $file = 'revision';
    757         $var  = 'revision';
    758         $action = '';
    759         break;
    760     default :
    761         if ( !current_user_can( 'edit_post', $post->ID ) )
    762             return apply_filters( 'get_delete_post_link', '', $post->ID, $context );
    763         $file = 'post';
    764         $var  = 'post';
    765         break;
    766     endswitch;
    767 
    768     return apply_filters( 'get_delete_post_link', wp_nonce_url( admin_url("$file.php?{$action}$var=$post->ID"), "trash-{$file}_" . $post->ID ), $context );
     740    if ( 'display' == $context )
     741        $action = '&action=trash';
     742    else
     743        $action = '&action=trash';
     744
     745    $post_type_object = get_post_type_object( $post->post_type );
     746    if ( !$post_type_object )
     747        return;
     748
     749    if ( !current_user_can( $post_type_object->delete_cap, $post->ID ) )
     750        return;
     751
     752    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 );
    769753}
    770754
Note: See TracChangeset for help on using the changeset viewer.