Make WordPress Core


Ignore:
Timestamp:
06/20/2023 03:45:23 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Media: Display the “Copy URL” and “Download file” row actions when the “Unattached” filter is applied.

Due to partially duplicated logic for displaying row actions in the Media Library with and without the “Unattached” filter, the “Copy URL” and “Download file” row actions were unintentionally missing with the filter applied.

This commit aims to simplify the logic and bring more consistency to the code.

Includes displaying the “Download file” row action even when the “Trash” filter is applied, giving the user one more chance to download the media file before they delete it.

Follow-up to [8901], [13100], [16227], [16229], [52842], [55198], [55221].

Props kebbet, costdev, pbiron, oglekler, SergeyBiryukov.
Fixes #57890, #57893.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/meta-boxes.php

    r55414 r55949  
    470470        if ( current_user_can( 'delete_post', $post->ID ) ) {
    471471                if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
    472                         echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Move to Trash' ) . '</a>';
     472                        printf(
     473                                '<a class="submitdelete deletion" href="%1$s">%2$s</a>',
     474                                get_delete_post_link( $post->ID ),
     475                                __( 'Move to Trash' )
     476                        );
    473477                } else {
    474                         $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
    475                         echo "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete permanently' ) . '</a>';
     478                        $show_confirmation = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
     479
     480                        printf(
     481                                '<a class="submitdelete deletion"%1$s href="%2$s">%3$s</a>',
     482                                $show_confirmation,
     483                                get_delete_post_link( $post->ID, '', true ),
     484                                __( 'Delete permanently' )
     485                        );
    476486                }
    477487        }
Note: See TracChangeset for help on using the changeset viewer.