Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ipokkel/2a9400ade6d44d474f7feb1a01d43f92 to your computer and use it in GitHub Desktop.
Save ipokkel/2a9400ade6d44d474f7feb1a01d43f92 to your computer and use it in GitHub Desktop.
Replace "Email Address" with "Username or Email Address" on PMPro Login Form
<?php
/**
* This recipe will search your codebase for
* translatable strings and replace when an exact match is found.
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function register_text( $translating ) {
// Bail if on password reset page
if (
( isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ) ||
( isset( $_REQUEST['checkemail'] ) && ! empty( $_REQUEST['checkemail'] ) ) ) {
return $translating;
}
//Replace "Email Address" with "Username or Email Address" on PMPro Login Form
$translated = str_ireplace( 'Email Address', 'Username or Email Address', $translating );
return $translated;
}
add_filter( 'gettext', 'register_text' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment