#35449 closed enhancement (fixed)
Add ability to filter back to blog link on login page
Reported by: | ebinnion | Owned by: | adamsilverstein |
---|---|---|---|
Milestone: | 5.7 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Login and Registration | Keywords: | has-patch has-screenshots commit has-dev-note |
Focuses: | Cc: |
Description
There is currently not a way to filter the "Back to {site_name_here}" link at the bottom of the /wp-login.php
page.
Depending on context, a user may want to change the text that is displayed in that link as well as the link itself. One example would be that on WordPress.com, we use this wording: "Return to {site_name_here}".
I propose that we add a filter that will allow developers to customize that link depending on context.
Attachments (7)
Change History (27)
#2
@
9 years ago
- Keywords dev-feedback added
- Owner set to adamsilverstein
- Status changed from new to assigned
@ebinnion Thanks for the patch! This seems like a useful enhancement.
In 35449.2.diff I did a tiny bit of cleanup:
- removed title attribute from link, we are trying not to use those and are even actively removing their existing use from core, see #24766
- removed escaping from translations, these are considered trusted in core
- added a translator comment so the context of %s in clear
- slight update to the filter description to mach how other filters are described
#3
@
9 years ago
- Milestone changed from Awaiting Review to Future Release
@adamsilverstein: 35449.2.diff introduces an inconsistency in changing the default "Back to %s" string to "Return to %s" while naming the filter "back_to_blog_link". We should probably pick one :-)
#6
follow-up:
↓ 7
@
4 years ago
- Keywords has-screenshots added
35449.3.diff
refreshes the patch against trunk and against some string changes that happened in WP 5.6.
I tested it using the following snippet:
<?php function my_login_site_html_link( $link ) { return '<a href="' . esc_url( home_url( '/' ) ) . '">' . __( 'Back to the website', 'my-theme' ) . '</a>'; } add_filter( 'login_site_html_link', 'my_login_site_html_link', 10, 1 );
Works fine (see before/after screenshots below).
My only concern is about the name of the filter. Any thought?
#7
in reply to:
↑ 6
@
4 years ago
Replying to audrasjb:
My only concern is about the name of the filter. Any thought?
The filter is filtering the HTML link <a>
element for going back to the root of the website. And it's on the login page.
I think 'login_site_html_link'
concisely captures what is being filtered.
#8
@
4 years ago
- Keywords dev-feedback removed
Tested. Works for me ✅
Used this testing code:
<?php add_filter( 'login_site_html_link', function () { return sprintf( '<a href="%s">%s</a>', esc_url( home_url( '/' ) ), /* translators: %s: Site title. */ esc_html_x( '← Back to home', 'site' ) ); } );
@audrasjb the patch escapes the URL, but not the translated string.
<?php _x( '← Go to %s', 'site' )
Shouldn't this be changed to?
<?php esc_html_x( '← Go to %s', 'site' )
#9
@
4 years ago
- Keywords commit added
Hey @hellofromTonya thanks for testing the patch!
There is no need to escape Core translation strings, as Core translations are validated by trusted editors (General Translation Editors of each Locale) :)
Given the patch has been tested, let's mark this for commit
This ticket was mentioned in Slack in #core by paaljoachim. View the logs.
4 years ago
#11
@
4 years ago
- Keywords needs-refresh added
Small change: get_bloginfo()
needs the display
context (see #26811).
get_bloginfo( 'title', 'display' )
#13
@
4 years ago
- Keywords commit added; needs-refresh removed
Thanks @sabernhardt, this is a good enhancement too. Patch updated accordingly.
#14
@
4 years ago
35449.1.diff looks good! I'll give this a final test suite run and get it committed.
This ticket was mentioned in PR #952 on WordPress/wordpress-develop by adamsilverstein.
4 years ago
#15
Trac ticket: https://core.trac.wordpress.org/ticket/35449
#18
@
4 years ago
Marking this "needs dev note" to make sure we document this filter in the release notes.
hellofromtonya commented on PR #952:
4 years ago
#19
Merged with changeset https://core.trac.wordpress.org/changeset/50117.
Adds back_to_blog_link filter to login footer.