Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Manually change text or translate text string for PMPro Approvals Add On using the gettext filter.
<?php
/**
* This recipe changes localized text strings for
* Paid Memberships Pro Approvals Add On using the gettext filter.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*
* 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 change_text_for_pmpro_approvals( $translated_text, $text, $domain ) {
// only do this in admin
if ( ! defined( 'PMPRO_APP_DIR' ) ) {
return $translated_text;
}
if ( 'pmpro-approvals' !== $domain ) {
return $translated_text;
}
switch ( $translated_text ) {
case 'Thank you for your membership to %1$s. Your %2$s membership status is: <b>%3$s</b>.':
// var_dump( $translated_text );
// return null;
// break;
$translated_text = __( 'Merci de votre adhésion à %1$s. Votre statut de membre %2$s est: <b> %3$s </b>.', 'pmpro-approvals' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'change_text_for_pmpro_approvals', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.