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

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

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

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.

    #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

    #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
    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 πŸ™‚

    #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
    Lead Developer

    No problem πŸ™‚

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.