[wp-trac] [WordPress Trac] #57890: Copy URL and Download Media List Table row actions don't appear when the "Unattached" filter is applied
WordPress Trac
noreply at wordpress.org
Thu Mar 9 06:56:52 UTC 2023
#57890: Copy URL and Download Media List Table row actions don't appear when the
"Unattached" filter is applied
-------------------------------------+---------------------------------
Reporter: pbiron | Owner: pbiron
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Media | Version: 6.0
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: ui, administration
-------------------------------------+---------------------------------
Comment (by kebbet):
Thanks for the similar PR @pbiron. Your approach looks better than the one
I added. Looking at the code for the View-action, I'm wondering if adding
a check for `wp_get_attachment_url( $post->ID )` would make sence, just
like `view` checks for `if ( get_permalink( $post->ID ) )`.
So something like this:
{{{#!php
<?php
if ( wp_get_attachment_url( $post->ID ) ) {
$actions['download'] = sprintf(
'<a href="%s" aria-label="%s" download>%s</a>',
esc_url( wp_get_attachment_url( $post->ID ) ),
/* translators: %s: Attachment title. */
esc_attr( sprintf( __( 'Download “%s”'
), $att_title ) ),
__( 'Download file' )
);
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/57890#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list