Make WordPress Core

Ticket #54824: 54824.diff

File 54824.diff, 2.0 KB (added by iqbalrony, 2 years ago)

Here is the patch with the fixed code.

  • src/wp-admin/includes/class-wp-media-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php
    index 0330b67f3b..d729da8043 100644
    a b class WP_Media_List_Table extends WP_List_Table { 
    767767                                }
    768768                        }
    769769
    770                         $actions['view'] = sprintf(
    771                                 '<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
    772                                 get_permalink( $post->ID ),
    773                                 /* translators: %s: Attachment title. */
    774                                 esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ),
    775                                 __( 'View' )
    776                         );
     770                        if( get_permalink( $post->ID ) ){
     771                                $actions['view'] = sprintf(
     772                                        '<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
     773                                        get_permalink( $post->ID ),
     774                                        /* translators: %s: Attachment title. */
     775                                        esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ),
     776                                        __( 'View' )
     777                                );
     778                        }
    777779
    778780                        if ( current_user_can( 'edit_post', $post->ID ) ) {
    779781                                $actions['attach'] = sprintf(
    class WP_Media_List_Table extends WP_List_Table { 
    828830                        }
    829831
    830832                        if ( ! $this->is_trash ) {
    831                                 $actions['view'] = sprintf(
    832                                         '<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
    833                                         get_permalink( $post->ID ),
    834                                         /* translators: %s: Attachment title. */
    835                                         esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ),
    836                                         __( 'View' )
    837                                 );
     833                                if ( get_permalink( $post->ID ) ) {
     834                                        $actions['view'] = sprintf(
     835                                                '<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
     836                                                get_permalink( $post->ID ),
     837                                                /* translators: %s: Attachment title. */
     838                                                esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ),
     839                                                __( 'View' )
     840                                        );
     841                                }
    838842
    839843                                $actions['copy'] = sprintf(
    840844                                        '<span class="copy-to-clipboard-container"><button type="button" class="button-link copy-attachment-url media-library" data-clipboard-text="%s" aria-label="%s">%s</button><span class="success hidden" aria-hidden="true">%s</span></span>',