#34356 closed enhancement (wontfix)
I should be able to change the Login/Logout text in wp_loginout()
Reported by: | aubreypwd | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Login and Registration | Keywords: | has-patch close |
Focuses: | Cc: |
Description
E.g.
<?php function my_login_text( $text ) { return __( "My Login" ); } add_filter( 'login_text', 'my_login_text' ); function my_logout_text( $text ) { return __( "My Logout" ); } add_filter( 'logout_text', 'my_logout_text' );
Attachments (1)
Change History (6)
#1
@
9 years ago
- Keywords has-patch added
Some related tickets:
https://core.trac.wordpress.org/ticket/5296 - "Login" used in place of "Log In" (Grammar error)
https://core.trac.wordpress.org/ticket/1088 - login verb phrase and noun conflict
#2
@
9 years ago
There's already the loginout
filter you can use to completely customize the link. There's also the universal gettext
filter to override internationalized strings.
Since the function is so simple, just creating your own or using the loginout
filter is much easier than adding two separate filters that only change the text. Core only uses the function in the Meta widget, so that'd be trivial.
#3
@
9 years ago
- Keywords close added
Out of interest, what do you *actually* want to change the text to in your use-case? (Note that "Login" is a noun, and "Logout" isn't a real word).
I don't think a filter here has much value.
#4
@
9 years ago
- Resolution set to invalid
- Status changed from new to closed
Closing, valid points. @johnbillion, "Sign-in" in this particular case.
Was able to use:
function my_login_menu_customize( $link ) {
if ( ! is_user_logged_in() ) {
return sprintf( '<a href="%s">%s</a>', wp_login_url(), __( 'Sign-in' ) );
} else {
return sprintf( '<a href="%s">%s</a>', wp_logout_url(), __( 'Sign-out' ) );
}
return $link;
}
add_filter( 'loginout', 'my_login_menu_customize' );
First Patch