Make WordPress Core


Ignore:
Timestamp:
05/21/2009 06:55:00 PM (16 years ago)
Author:
ryan
Message:

eliminate duplicate cap checks. Props coffee2code. fixes #9899

File:
1 edited

Legend:

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

    r11425 r11426  
    725725        return;
    726726
    727     if ( $post->post_type == 'page' ) {
    728         if ( !current_user_can( 'edit_page', $post->ID ) )
    729             return;
    730     } else {
    731         if ( !current_user_can( 'edit_post', $post->ID ) )
    732             return;
    733     }
    734 
    735     $link = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
     727    if ( !$url = get_edit_post_link( $post->ID ) )
     728        return;
     729
     730    $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>';
    736731    echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;
    737732}
Note: See TracChangeset for help on using the changeset viewer.