Make WordPress Core

Ticket #41663: filter_back_to_blog_link.diff

File filter_back_to_blog_link.diff, 1.7 KB (added by Fleuv, 5 years ago)

This patch works with the trunk, but requires a tiny bit of testing. Almost 100% sure that this will work smoothly.

  • wp-login.php

     
    257257        global $interim_login;
    258258
    259259        // Don't allow interim logins to navigate away from the page.
    260         if ( ! $interim_login ) :
    261                 ?>
    262         <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    263                 <?php
     260        if ( ! $interim_login ) {
     261
     262                $url = esc_url( home_url( '/' );
     263               
     264                /**
     265                 * Filters the url what is used for the back to blog link in the footer.
     266                 *
     267                 * @since 4.8.2
     268                 *
     269                 * @param string $url The back to blog url.
     270                 */
     271                $backtoblog_url =  apply_filters( 'login_backtologin_url', $url );
     272
    264273                /* translators: %s: site title */
    265                 printf( _x( '&larr; Back to %s', 'site' ), get_bloginfo( 'title', 'display' ) );
    266                 ?>
    267         </a></p>
    268                 <?php the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' ); ?>
    269         <?php endif; ?>
     274                $text = sprintf( _x( '&larr; Back to %s', 'site' ), get_bloginfo( 'title', 'display' ) );
    270275
     276                /**
     277                 * Filters the text of the back to blog link in the footer.
     278                 *
     279                 * @since 4.8.2
     280                 *
     281                 * @param string $text The text inside back to blog link.
     282                 */
     283                $backtoblog_text = apply_filters( 'backtoblog_text', $text );
     284
     285
     286                $html = '<p id="backtoblog"><a href="'. $backtoblog_url .'">' $backtoblog_text . '</a></p>';
     287
     288                /**
     289                 * Filters the HTML of the back to blog link in the footer.
     290                 *
     291                 * @since 4.8.2
     292                 *
     293                 * @param string $html The back to blog html.
     294                 */
     295                echo apply_filters( 'login_backtologin', $html );
     296                the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' );
     297        }
     298
     299        ?>
    271300        </div>
    272301
    273302        <?php if ( ! empty( $input_id ) ) : ?>