• I have search online on how to remove the website input on the comment but non of it work for this theme. Please I need help on removing it.

    Thank you.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author oceanwp

    (@oceanwp)

    Hello, have you tried to add this code in the functions.php file of your child theme:

    function prefix_disable_comment_url($fields) { 
        unset($fields['url']);
        return $fields;
    }
    add_filter('comment_form_default_fields','prefix_disable_comment_url');
    
    Thread Starter David Webb Espiritu

    (@webbteche)

    Thanks for the feedback.
    Yep, I did add it on my child theme.
    My reference was:
    https://crunchify.com/how-to-remove-url-website-field-from-wordpress-comment-form

    I even tried to edit the comments.php from the parent theme but didn’t find any fields. And I think it’s not a good idea to edit it from the parent theme.

    If I’m missing something please let me know.

    Theme Author oceanwp

    (@oceanwp)

    Hi, you’re right, never edit any files from the parent theme, always use a child theme.
    For your problem, sorry, but the website field in the comments come from WordPress, I never tried to disable it, so you will need to do some search on google. Maybe the best solution for you would be to use a plugin to replace the default comments and give you control on the fields.

    Thread Starter David Webb Espiritu

    (@webbteche)

    Hi,

    Guess I’ll just set the css of it to “display:none”. Even though it will trigger my OCD. hahaha! I don’t want plugins either cause I limit the use of plugin on my site.

    Anyway, Thanks for the help and KUDOS for a great theme!

    Theme Author oceanwp

    (@oceanwp)

    Hi, yes css is a good solution too ??

    I have also had difficulty with this.
    I tried to unset the url field from the $fields array, and it doesn’t work.
    I even tried to edit the comments.php file, entering my own fields array:

    comment_form(
    	array(
    		'must_log_in'			=> '<p class="must-log-in">'.  sprintf( esc_html__( 'You must be %1$slogged in%2$s to post a comment.', 'oceanwp' ), '<a href="'. wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) .'">', '</a>' ) .'</p>',
    		'logged_in_as'			=> '<p class="logged-in-as">'. esc_html__( 'Logged in as', 'oceanwp' ) .' <a href="'. admin_url( 'profile.php' ) .'">'. $user_identity .'</a>. <a href="' . wp_logout_url( get_permalink() ) .'" title="'. esc_html__( 'Log out of this account', 'oceanwp' ) .'">'. esc_html__( 'Log out', 'oceanwp' ) .'</a></p>',
    		'comment_notes_before'	=> false,
    		'comment_notes_after'	=> false,
    		'comment_field'			=> '<div class="comment-textarea"><textarea name="comment" id="comment" cols="39" rows="4" tabindex="100" class="textarea-comment" placeholder="'. esc_html__( 'Your Comment Here...', 'oceanwp' ) .'"></textarea></div>',
    		'id_submit'				=> 'comment-submit',
    		'label_submit'			=> esc_html__( 'Post Comment', 'oceanwp' ),
    			
    		'fields' => apply_filters( 'comment_form_default_fields', array(
    
    			'author' =>
    				'<p class="comment-form-author">' .
    				'<label for="author">' . __( 'Name', 'domainreference' ) . '</label> ' .
    				  ( $req ? '<span class="required">*</span>' : '' ) .
    				  '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .
    				  '" size="30"' . $aria_req . ' /></p>',
    
    			'email' =>
    				'<p class="comment-form-email"><label for="email">' . __( 'Email', 'domainreference' ) . '</label> ' .
    				  ( $req ? '<span class="required">*</span>' : '' ) .
    				'<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .
    				  '" size="30"' . $aria_req . ' /></p>',
    
    			'url' => ''
    				
    			) //fields array
    		) //apply_filters
    	)//comment form args array
    ); //comments form function brackets

    As you can see, I have set the 'url' field as empty. It still shows up “normally” in the comment form.

    Any news on this by any chance?

    • This reply was modified 6 years, 8 months ago by udidol.
    Theme Author oceanwp

    (@oceanwp)

    Hello, check the “oceanwp_modify_comment_form_fields” function in the helpers.php file in oceanwp/inc. Copy this function in your child theme functions.php file and edit it.

    Yes!
    I used the helper function, set $fields['url'] = ''; and that was it.

    Worked great, thanks.

    Theme Author oceanwp

    (@oceanwp)

    You’re welcome ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to remove Website input from comment?’ is closed to new replies.