Forked from MaryOJob/my_pmpro_change_text_page_example.php
Last active
February 2, 2022 15:55
-
-
Save kimwhite/3774251e40d21760bab292d2146c44e9 to your computer and use it in GitHub Desktop.
Change PMPro Wording on Edit Profile Page
This file contains hidden or 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 | |
/** | |
* This recipe changes the text 'Cancel' only on the Edit Profile Page because the word also appears on the Membership accounts page | |
* This should be added to a PMPro Customizations or Code Snippets Plugin: https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
* Thank you to Ronald, for assisting in writing this snippet. | |
**/ | |
function pmpro_init_cancel_gettext() { | |
add_filter( 'gettext', 'pmpro_change_cancel_text_gettext', 10, 3 ); | |
} | |
add_action( 'init', 'pmpro_init_cancel_gettext' ); | |
function pmpro_change_cancel_text_gettext( $translated_text, $text, $domain ) { | |
if ( is_page( 'your-profile' ) && 'paid-memberships-pro' === $domain ) { | |
if ( 'Cancel' === $text ) { | |
return 'Back to My Account'; | |
} | |
} | |
return $translated_text; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment