Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created December 18, 2024 14:01
Show Gist options
  • Save ipokkel/a5617b979fab90c85a13c5690fd9c09a to your computer and use it in GitHub Desktop.
Save ipokkel/a5617b979fab90c85a13c5690fd9c09a to your computer and use it in GitHub Desktop.
<?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