Skip to content

Instantly share code, notes, and snippets.

@cubehrends
Last active May 18, 2018 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cubehrends/654d360ece4045bec40ccd831e976af4 to your computer and use it in GitHub Desktop.
Save cubehrends/654d360ece4045bec40ccd831e976af4 to your computer and use it in GitHub Desktop.
How to customize the Comment Form Cookies Consent Label in WordPress 4.9.6
<?php
/* the code below goes into your child themes functions.php
=============================================================== */
function customize_comment_form_cookies_consent_label( $translated, $original, $domain ) {
$strings = array(
'Save my name, email, and website in this browser for the next time I comment.' => '=> YOUR CUSTOMIZED TEXT GOES HERE <='
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'customize_comment_form_cookies_consent_label', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment