mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Media: Hide 'view' link if empty string passed to attachment_link.
Fix empty href attribute on 'View' link when the `attachment_link` filter is used to hide attachment pages. Props oh_hello, iqbalrony. Fixes #54824. git-svn-id: https://develop.svn.wordpress.org/trunk@55218 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -768,13 +768,15 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||
}
|
||||
}
|
||||
|
||||
$actions['view'] = sprintf(
|
||||
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
|
||||
get_permalink( $post->ID ),
|
||||
/* translators: %s: Attachment title. */
|
||||
esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
|
||||
__( 'View' )
|
||||
);
|
||||
if ( get_permalink( $post->ID ) ) {
|
||||
$actions['view'] = sprintf(
|
||||
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
|
||||
get_permalink( $post->ID ),
|
||||
/* translators: %s: Attachment title. */
|
||||
esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
|
||||
__( 'View' )
|
||||
);
|
||||
}
|
||||
|
||||
if ( current_user_can( 'edit_post', $post->ID ) ) {
|
||||
$actions['attach'] = sprintf(
|
||||
@@ -829,13 +831,15 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||
}
|
||||
|
||||
if ( ! $this->is_trash ) {
|
||||
$actions['view'] = sprintf(
|
||||
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
|
||||
get_permalink( $post->ID ),
|
||||
/* translators: %s: Attachment title. */
|
||||
esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
|
||||
__( 'View' )
|
||||
);
|
||||
if ( get_permalink( $post->ID ) ) {
|
||||
$actions['view'] = sprintf(
|
||||
'<a href="%s" aria-label="%s" rel="bookmark">%s</a>',
|
||||
get_permalink( $post->ID ),
|
||||
/* translators: %s: Attachment title. */
|
||||
esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ),
|
||||
__( 'View' )
|
||||
);
|
||||
}
|
||||
|
||||
$actions['copy'] = sprintf(
|
||||
'<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>',
|
||||
|
||||
Reference in New Issue
Block a user