Created
December 18, 2024 14:01
-
-
Save ipokkel/a5617b979fab90c85a13c5690fd9c09a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* A simple example to show you how to change an error message for checkout on Paid Memberships Pro. | |
* | |
* 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 pmpro_change_error_message( $translated_text, $text, $domain ) { | |
if ( 'paid-memberships-pro' !== $domain ) { | |
return $translated_text; | |
} | |
switch ( $text ) { | |
case 'That email address is already in use. Please log in, or use a different email address.': | |
$translated_text = __( 'That email address is already in use. Please<a href="/login/">log in</a>, or use a different email address.', 'paid-memberships-pro' ); | |
break; | |
} | |
return $translated_text; | |
} | |
add_filter( 'gettext', 'pmpro_change_error_message', 20, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment