Make WordPress Core


Ignore:
Timestamp:
05/12/2011 06:04:47 AM (13 years ago)
Author:
nacin
Message:

Don't show broken 'View' links when a CPT isn't publicly queryable. fixes #13301, props johnbillion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-posts-list-table.php

    r17771 r17899  
    551551                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
    552552                }
    553                 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
    554                     if ( $can_edit_post )
    555                         $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
    556                 } elseif ( 'trash' != $post->post_status ) {
    557                     $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
     553                if ( $post_type_object->publicly_queryable ) {
     554                    if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) {
     555                        if ( $can_edit_post )
     556                            $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
     557                    } elseif ( 'trash' != $post->post_status ) {
     558                        $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
     559                    }
    558560                }
    559561
Note: See TracChangeset for help on using the changeset viewer.