Skip to content

Instantly share code, notes, and snippets.

@Pebblo Pebblo/functions.php Secret
Last active Jul 14, 2016

What would you like to do?
An example of changing 'Attendee Information' and the text used within the confirmation box.
<?php //Please do not add the opening PHP tag if you already have one.
function mycustom_filter_gettext( $translated, $original, $domain ) {
// This is an array of original strings
// and what they should be replaced with
$strings = array(
'Attendee Information' => 'REPLACE ME WITH CUSTOM TEXT 1',
'%1$sCongratulations%2$sYour registration has been successfully processed.%3$sCheck your email for your registration confirmation or click the button below to view / download / print a full description of your purchases and registration information.' => 'REPLACE ME WITH CUSTOM TEXT 2',
// Add some more strings here
// See if the current string is in the $strings array
// If so, replace its translation
if ( isset( $strings[$original] ) ) {
// This accomplishes the same thing as __()
// but without running it through the filter again
$translations = get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
return $translated;
add_filter( 'gettext', 'mycustom_filter_gettext', 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.