Skip to content

Commit

Permalink
checking if post id is false before getting post for selected rows an…
Browse files Browse the repository at this point in the history
…d removing duplicate get_post_type_object call
  • Loading branch information
Kevin Langley committed Jan 7, 2013
1 parent 2cecb2a commit f501616
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions post-selection-ui.php
Expand Up @@ -170,8 +170,8 @@ public function render_addable_rows($wp_query) {
$title = esc_html(get_the_title($post->ID));

$row_actions = '';
$can_edit = current_user_can( get_post_type_object( get_post_type($post->ID) )->cap->edit_post, $post->ID );
$post_type_object = get_post_type_object( get_post_type($post->ID));
$can_edit = current_user_can( $post_type_object->cap->edit_post, $post->ID );

if( $can_edit )
$row_actions .= sprintf('<span class="edit"><a title="Edit this item" href="%s">Edit</a> | </span>', get_edit_post_link( $post->ID ));
Expand Down Expand Up @@ -206,7 +206,7 @@ public function render_addable_rows($wp_query) {
private function render_selected_rows($post_ids) {
$output = '';
foreach($post_ids as $post_id) {
if(!get_post($post_id)) {
if(!$post_id || !get_post($post_id)) {
continue;
}

Expand Down

0 comments on commit f501616

Please sign in to comment.