[Resolved] Edit comment cookies text "Save my name, email, and website . . ."

Home Forums Support Edit comment cookies text "Save my name, email, and website . . ."

This topic contains 6 replies, has 3 voices, and was last updated by  Tom 1 year, 5 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #585870

    Flavio

    Hello,

    I’d like to edit the cookie opt-in checkbox text “Save my name, email, and website in this browser for the next time I comment.”

    Basically I’d like to remove the word “website” as my comment post section does not have a Website field.

    Any help is greatly appreciated.

    Thanks.

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #585892

    Lyle

    Hi Flavio,

    You can do so with the Loco Translate plugin. I just tried it and it works fine 🙂 Keep in mind that this text is coming from WordPress and not GeneratePress (or any theme); the theme just controls how it looks.

    https://wordpress.org/plugins/loco-translate/

    Cheers!
    Lyle

    http://snifflevalve.com
    Tutorials and tips for GeneratePress, WP Show Posts, WordPress and Elementor

    #585894

    Flavio

    Thanks Lyle.

    While plugins are great, I am trying to limit their number as much as possible. I’m a minimalist 🙂

    I just need to either find the exact location of this text (file name) or simply edit via CSS. I can take care of the rest afterwards.

    Again, thank you for the reply and for the plugin tip!

    Flavio

    #585895

    Tom Lead Developer

    Hi there,

    Give this a shot:

    add_filter( 'comment_form_default_fields', 'tu_filter_comment_fields', 20 );
    function tu_filter_comment_fields( $fields ) {
        $commenter = wp_get_current_commenter();
    
        $consent   = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"';
    
        $fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' . '<label for="wp-comment-cookies-consent">TEXT FOR CHECKBOX HERE</label></p>';
    
        return $fields;
    }
    #585896

    Lyle

    Unfortunately, it’s not a “text” file but in one of the core WP php files, the editing of which is not recommended as they will be negated on the next update.

    Once you do the edit with Loco Translate, you can delete the plugin as it creates a file with the change that is update safe 🙂

    http://snifflevalve.com
    Tutorials and tips for GeneratePress, WP Show Posts, WordPress and Elementor

    #585923

    Flavio

    Thank you Tom and Lyle.

    I didn’t use your suggestions, but I was able to make the edit I needed (remove the word “website” from the opt-in label text).

    Your help was very much appreciated.

    Thank you!

    #585961

    Tom Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.