Make WordPress Core

Changeset 49222


Ignore:
Timestamp:
10/20/2020 02:27:39 AM (15 months ago)
Author:
antpb
Message:

Media: Allow hiding of ‘View attachment page’ link in media modal.
If an empty string is supplied to the attachment_link filter the ‘View attachment page’ link will be hidden in the media modal.
Props limera1n, garrett-eclipse, joemcgill, Mista-Flo, hellofromTonya.
Fixes #48325.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r49108 r49222  
    453453     *
    454454     * @since 2.0.0
     455     * @since 5.6.0 Providing an empty string will now disable
     456     *              the view attachment page link on the media modal.
    455457     *
    456458     * @param string $link    The attachment's permalink.
  • trunk/src/wp-includes/media-template.php

    r49215 r49222  
    515515
    516516            <div class="actions">
    517                 <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
    518                 <# if ( data.can.save ) { #> |
     517                <# if ( data.link ) { #>
     518                    <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a>
     519                <# } #>
     520                <# if ( data.can.save ) { #>
     521                    <# if ( data.link ) { #>
     522                        <span class="links-separator">|</span>
     523                    <# } #>
    519524                    <a href="{{ data.editLink }}"><?php _e( 'Edit more details' ); ?></a>
    520525                <# } #>
    521                 <# if ( ! data.uploading && data.can.remove ) { #> |
     526                <# if ( ! data.uploading && data.can.remove ) { #>
     527                    <# if ( data.link || data.can.save ) { #>
     528                        <span class="links-separator">|</span>
     529                    <# } #>
    522530                    <?php if ( MEDIA_TRASH ) : ?>
    523531                        <# if ( 'trash' === data.status ) { #>
Note: See TracChangeset for help on using the changeset viewer.