[Resolved] How to remove email and url field from the comment form ?

Home Forums Support [Resolved] How to remove email and url field from the comment form ?

Home Forums Support How to remove email and url field from the comment form ?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #665194
    Tayla

    Hi! I want to remove the email and url fiel at the comments. i get it onced, but after new update, the fields still show. how can i remove them?

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #665206
    David
    Staff
    Customer Support

    Hi there,

    try this PHP snippet:

    add_action( 'after_setup_theme', 'tu_add_comment_url_filter' );
    function tu_add_comment_url_filter() {
        add_filter( 'comment_form_default_fields', 'tu_disable_comment_url', 20 );
    }
    
    function tu_disable_comment_url($fields) {
        unset($fields['url']);
        unset($fields['email']);
        return $fields;
    }

    https://docs.generatepress.com/article/adding-php/

    Just make sure to check that neither are required in the wordpress settings.

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