From c96930408d75bf5ce222e4e5785fa202c6d2a582 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 12 May 2011 06:04:47 +0000 Subject: [PATCH] Don't show broken 'View' links when a CPT isn't publicly queryable. fixes #13301, props johnbillion. git-svn-id: https://develop.svn.wordpress.org/trunk@17899 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/class-wp-posts-list-table.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index a4f10f1a7d..c9c9c13ac8 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -550,11 +550,13 @@ class WP_Posts_List_Table extends WP_List_Table { if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) $actions['delete'] = "" . __( 'Delete Permanently' ) . ""; } - if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { - if ( $can_edit_post ) - $actions['view'] = '' . __( 'Preview' ) . ''; - } elseif ( 'trash' != $post->post_status ) { - $actions['view'] = '' . __( 'View' ) . ''; + if ( $post_type_object->publicly_queryable ) { + if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { + if ( $can_edit_post ) + $actions['view'] = '' . __( 'Preview' ) . ''; + } elseif ( 'trash' != $post->post_status ) { + $actions['view'] = '' . __( 'View' ) . ''; + } } $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post );